Power Apps – filter datasource for records between two dates

Print Friendly, PDF & Email

Filter a gallery control to show only items between two dates selected from two datepickers.

Gallery listing items between two dates

In this example I added two datepickers to the canvas. Name them dtFromDate and dtToDate.
I then added a vertical gallery control and named it glShoots.
I added a datasource named Photoshoots. In my example this is a Dataverse table, but a SharePoint list with two date columns should work the same.

In the Items properties of the gallery we will put this formula:

Filter(Photoshoots,FromShootDate >= dtFromDate.SelectedDate And ToShootDate <= dtToDate.SelectedDate)

This will filter the gallery to only show items betwen the two selected dates.

If we wanted the opposite to happen, not show any records from the selected dates, we would replace the formula in the Items property in the gallery with something like this:

Filter(Photoshoots,FromShootDate > dtToDate.SelectedDate Or ToShootDate < dtFromDate.SelectedDate)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.