cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowerAppsHori
Helper I
Helper I

Filtering Gallery by Date Won’t Work if Dates Match (i.e. Datepicker Date Matches Gallery Item’s Date)

I was watching this wonderful video by Reza Dorrani: 

https://youtu.be/5dSk5iOgT68

 

I am filtering a gallery that’s pulling information from a SharePoint list. The filter is filtering by modified date. So I have the following code in my Filter:

 

Modified >= FromDate.SelectedDate && Modifed <= ToDate.SelectedDate

 

It works great except for when dates match the Gallery date and it seems to be specific to the ToDate. For example, let’s say a listed item in the gallery was modified on July 10. If I selected July 10 in the FromDate datepicker, the listed items last modified on that date remain in the gallery. However, if I select July 10 in the ToDate datepicker, the items last modified on July 10 disappear from the Gallery. 

 

I would think the ‘equals to’ in the code would capture this date, but it doesn’t seem to. Am I doing something wrong? Can someone help? Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
iltoningui
New Member

Hi @PowerAppsHori,

 

I can't really be sure without more info, but i'm pretty sure that FromDate.SelectedDate and ToDate.SelectedDate are datetime values not date and most likely have midnight the time.

 

If that's the case you are comparing values between 2021-07-21 00:00:00 and 2021-07-21 00:00:00 which would return nothing.

 

 

DateTimeValue(Text(FromDate.SelectedDate, "[$-en-US]mm/dd/yyyy") & ",00:00:00");
DateTimeValue(Text(ToDate.SelectedDate, "[$-en-US]mm/dd/yyyy") & ",23:59:59")

 

 

This will ensure that the interval includes the entire day.

 

If this reply helped,

Consider marking it as a solution.

View solution in original post

3 REPLIES 3
gabibalaban
Super User II
Super User II

@PowerAppsHori ,

Use:

Modified >= FromDate.SelectedDate && Modifed <= DateAdd(ToDate.SelectedDate,1,Days)

I think that you will receive a delegation warning, but this can be solved with a context variable.

 

hope it helps !

iltoningui
New Member

Hi @PowerAppsHori,

 

I can't really be sure without more info, but i'm pretty sure that FromDate.SelectedDate and ToDate.SelectedDate are datetime values not date and most likely have midnight the time.

 

If that's the case you are comparing values between 2021-07-21 00:00:00 and 2021-07-21 00:00:00 which would return nothing.

 

 

DateTimeValue(Text(FromDate.SelectedDate, "[$-en-US]mm/dd/yyyy") & ",00:00:00");
DateTimeValue(Text(ToDate.SelectedDate, "[$-en-US]mm/dd/yyyy") & ",23:59:59")

 

 

This will ensure that the interval includes the entire day.

 

If this reply helped,

Consider marking it as a solution.

View solution in original post

This worked perfectly thank you!!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,168)