Welcome to my Power Apps guide on how to filter a gallery by a date range.
Inside you will find 26 examples of common scenarios filtering a Power Apps gallery by date range. Each page contains code and visuals to show what the code is doing. COPY + PASTE code from the guide into your own app. Just change the datasource name and column names to match your own.
This guide will grow as I add more examples so be sure to bookmark it!
Basics
Filter A Date Range By Day
- Current Day (Today)
- Next Day (Tomorrow)
- Dates Next In ‘N’ Days
- Previous Day (Yesterday)
- Dates In Previous ‘N’ Days
Filter A Date Range By Week
Filter A Date Range By Month
Filter A Date Range Quarter
Filter A Date Range By Year
Did You Enjoy This Article?
Subscribe at the bottom of this page to have new articles sent directly to your inbox the moment I post them.
Questions?
If you have any questions or feedback about Power Apps Filter A Gallery By Date Range Examples please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.
This is very helpful indeed
Akbar,
I’m glad to hear it. Thank you for taking the time to leave me this message.
Just what I was looking for this last month!
Ninett,
So close… oh well, least you have it for the next one!
Very timely! I just needed it today
Hi Bejeweled One!
I recognize you from the Power Apps forums. Glad I could help!
Awesome. This definitely helps. Thank you!.
I have a quick question. How do I get the week number for the current week in canvas app?
Jeteen,
You can find my repo of Date functions for Power FX (and Power Apps) on Github here:
https://github.com/pnp/powerfx-samples/tree/main/samples/date-functions
To find the week number code like this is required where StartDate (date), EndDate (date) and DayWeekStart (number) are parameters you must define.
Sum(
AddColumns(
ForAll(
Sequence(
DateDiff(
Date(Year(StartDate),1,1),
StartDate,
Days
)
),
Date(Year(StartDate),1,1) + Value
),
“IsWeekStart”,
Weekday(Value)=DayWeekStart
),
IsWeekStart
)
How would you filter by Name and weekly date range ?
Moyura,
You could add something like “And Name = value” to one of the week filtering techniques I provided.
I have 2 lists.
1 has the list of cars information about the car with registration plate etc.
2 has a startdate and endate and the selected car numberplate when booked.
I want to have users select a startdate and an enddate. then the gallery should shown only the cars that are available for booking during that datetime period. .
Andre,
I think the Items property of the gallery would look something like this:
Filter(
‘SharePoint List’,
CarBookingStartDate >= drpStartDate.SelectedDate,
CarBookingEndDate <= drpEndDate.SelectedDate) )
Jacob,
I think it would be like this:
With(
{
StartDate: Date(
Year(Today()),
Month(Today())-2, // change this number
Day(Today())
)+1,
EndDate: Date(
Year(Today()),
Month(Today()),
Day(Today())
)
},
| Sort(
Filter(
‘Calendar Dates’,
CalendarDate >= StartDate,
CalendarDate <= EndDate ), CalendarDate, Ascending ) )