web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter by Date produce...
Power Apps
Answered

Filter by Date produce wrong result

(0) ShareShare
ReportReport
Posted on by 127

This is a canvas app connecting to an Azure MS SQL database. The data field contains date/time. The filter is to get all records matching a specific date from DatePicker (even if I hard code a specific date in the Filter, still wrong result). Records contains date/time starting at 12:xx am of the filter date are omitted. Records starting at 12:xx am of the next date are included in the result.

For example, the search date is 5/21/2022. Records with date 5/22/2022 12: 05 am is returned, but record with date 5/21/2022 12:05 am is not. I suspect this has something to do with time zone.

 

Code:

Filter(Attendance,
checkIn >= DatePicker1.SelectedDate,
checkIn < DateAdd(DatePicker1.SelectedDate, 1, Days))

Categories:
I have the same question (0)
  • AhmedSalih Profile Picture
    6,680 Moderator on at

    Hello, @tedqn77 , Try this:

    Filter(AddColumns(Attendance, "checkInDateOnly", Text(checkIn, DateTimeFormat.ShortDate)),
     checkInDateOnly >= DatePicker1.SelectedDate,
     checkInDateOnly < DateAdd(DatePicker1.SelectedDate, 1, Days))

     

     

    Regards,
    Ahmed
    If my reply helped you, please give a 👍. And if it has solved your issue, please consider Accepting it as the Solution to help other members of the community find it more.

  • Verified answer
    tedqn77 Profile Picture
    127 on at

    Thank you for the idea of adding column with truncated date/time into date. I was able to use your syntax with modification to make it work. The newly added column is a text type so it complains incompatible type conversion so I have to convert it back to date. And since it's just a date I can directly compare with the DatePicker.SelectedDate

     

    Filter(AddColumns(MealAttendance, "checkInDateOnly", Text(checkIn, DateTimeFormat.ShortDate)),
    DateValue(checkInDateOnly) = DatePicker1.SelectedDate)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard