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 / Filtering Gallery by D...
Power Apps
Answered

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

(1) ShareShare
ReportReport
Posted on by 122

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!

Categories:
I have the same question (0)
  • CU-18081211-6 Profile Picture
    9,272 Moderator on at

    @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 !

  • Verified answer
    iltoningui Profile Picture
    247 on at

    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.

  • PowerAppsHori Profile Picture
    122 on at

    This worked perfectly thank you!!

  • Rahul_Tantia Profile Picture
    22 on at
    It is because the dates are capturing the time values also while comparing the values.
     
    The work around is to add 1 extra day to get the data till current date. 
     
    Modified <= DateAdd(ToDate.SelectedDate,1,TimeUnit.Days)

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 429 Most Valuable Professional

#2
11manish Profile Picture

11manish 191 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 122 Super User 2026 Season 2

Last 30 days Overall leaderboard