This Power Apps tutorial will help you to learn how to work with Power Apps Filter Gallery By Date with various examples.
Also, we will discuss how to filter Power Apps gallery by Date range, how to filter Power Apps gallery by today’s date, and many more like:
- Filter Power Apps Gallery if the Date is today or greater than today’s date
- Filter Power Apps Gallery By Today Or Yesterday
Check out: Power Apps Gallery Control Examples Download [20 Various Real Scenarios]
Set up a SharePoint List
I have used a SharePoint list Job Seekers Registration List for all the above examples. This list has these many columns (with different data types):
Columns | Data types |
---|---|
First Name | Single line of text (This is a Title column, I just renamed it to First Name) |
Surname | Single line of text |
Registration ID | Number |
Apply Date | Date and time |
Also, this list has some records, as shown in the below screenshot.
Power Apps Filter Gallery by Date
In this example, we will see how to work with the Power Apps filter gallery by date.
- The screenshot below represents a Power Apps Date picker and Gallery control. When a user selects any date from the date picker, the gallery will filter and display the records based on the selected date. All the gallery data will come from the SharePoint list [Job Seekers Registration List].
- For example, when I selected the date as “8/8/2023“, the gallery filtered and displayed all the records of that specific date.
- To work around this, select the gallery control and apply the code below on its Items property as:
Items = Filter(
'Job Seekers Registration List',
Text(
'Apply Date',
DateTimeFormat.ShortDate
) = Text(
dtApplyDate.SelectedDate,
DateTimeFormat.ShortDate
)
)
Where,
- ‘Apply Date’ = SharePoint Date column
- dtApplyDate = Date picker control name
This is how we can filter the Power Apps gallery by date value.
Power Apps Filter Gallery by Date Range
Here we will see how to work with Power Apps Filter Gallery by Date Range.
- The below image represents two Power Apps Date picker controls (Select Start Date & Select End Date) and a Gallery control. When a user selects a specific start date and end date, the gallery will filter and display all the records within the selected date range.
- For example, when I selected the Start Date as “8/5/2023” and End Date as “8/8/2023“, the gallery filtered and displayed the records within the selected 5-8 date range.
- To achieve this, select the gallery and apply the code below on its Items property as:
Items = Filter(
'Job Seekers Registration List',
'Apply Date' >= dtStartDate.SelectedDate,
'Apply Date' <= dtEndDate.SelectedDate
)
OR
Items = Filter(
'Job Seekers Registration List',
('Apply Date' >= dtStartDate.SelectedDate) && ('Apply Date' <= dtEndDate.SelectedDate)
)
We can use any of the above formulas.
Where,
- ‘Job Seekers Registration List’ = SharePoint List Name
- ‘Apply Date’ = SharePoint Date Column
- dtStartDate = Date picker control name of the Start Date
- dtEndDate = Date picker control name of the End Date
This is how to Filter Power Apps Gallery by Date Range.
Power Apps Filter Gallery by Today’s Date
This section will use various scenarios to show how to work with Power Apps Filter Gallery by Today’s Date.
Example – 1: [Filter Power Apps Gallery by Today]
- The figure below represents a Power Apps gallery that displays all the records based on Today’s Date, i.e., 8/17/2023.
- To do so, select the gallery control and set its Items property to the below formula:
Items = Filter(
'Job Seekers Registration List',
'Apply Date' >= Today(),
'Apply Date' < DateAdd(
Today(),
1,
TimeUnit.Days
)
)
OR
Items = With(
{
StartDate: Today(),
EndDate: Today() + 1
},
Filter(
'Job Seekers Registration List',
'Apply Date' >= StartDate,
'Apply Date' < EndDate
)
)
We can use any of the above formulas.
Where,
- ‘Job Seekers Registration List‘ = SharePoint List Name
- ‘Apply Date‘ = SharePoint Date Column
- StartDate, EndDate = Scope variable names
This is how to filter the Power Apps gallery by today’s date.
Example – 2: [Filter Power Apps Gallery if Date is today or greater than today’s date]
- Next, we will see how to filter Power Apps Gallery if Date is today or greater than today’s date. As today’s date is 8/17/2023, the gallery below displays all the current and future records, i.e., 8/18/2023.
- To work with this, apply the code below on the gallery’s Items property:
Items = Filter(
'Job Seekers Registration List',
'Apply Date' >= Today()
)
Where,
‘Apply Date‘ = SharePoint Date Column
This is all about Filter Power Apps Gallery if Date is today or greater than today.
Example – 3: [Filter Power Apps Gallery By Today Or Yesterday]
- Similarly, if a user wants to filter the Power Apps gallery by today or yesterday’s date, this scenario will help.
- As today’s date is 8/17/2023, the gallery below displays all the current and yesterday’s records, i.e., 8/16/2023.
- To achieve this, write the below code on the gallery’s Items property:
Items = Filter(
'Job Seekers Registration List',
(Text(
'Apply Date',
DateTimeFormat.ShortDate
) = Text(
Today(),
DateTimeFormat.ShortDate
) || Text(
DateAdd(
Today(),
-1,
TimeUnit.Days
),
DateTimeFormat.ShortDate
) = Text(
'Apply Date',
DateTimeFormat.ShortDate
))
)
Refer to the image below.
This is all about Filter Power Apps Gallery By Today Or Yesterday.
Additionally, you may like some more Power Apps tutorials:
- Power Apps Filter Gallery By Last Week [With Various Scenarios]
- How to Filter Gallery by Current User in Power Apps
- Power Apps Gallery Conditional Formatting [With 11 Examples]
- How to Add Gallery Data to a Collection in Power Apps
- Power Apps Filter Gallery By Last Month [With Various Examples]
- Power Apps Sort Gallery By Calculated Field
- Count Rows in Power Apps Gallery Control
In this Power Apps tutorial, we discussed how to filter Power Apps gallery by date, and how to filter Power Apps gallery by date range with different examples.
Moreover, we learned some more below topics as well:
- Power Apps filter gallery by today’s date
- Filter Power Apps Gallery if Date is today or greater than today’s date
- Filter Power Apps Gallery By Today Or Yesterday
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com