In my recent Power Apps application, I have used a gallery control containing some records from the SharePoint list. I wanted to filter the gallery data by the current and previous years.
In this article, I will explain how to filter Power Apps gallery by year, including the current year, the previous year, and the upcoming years.
In addition, we will also discuss filtering the Power Apps gallery by the next N years and previous N years with various scenarios.
Filter Power Apps Gallery By Current Year
Let’s discuss how to filter the gallery by current year in Power Apps.
Example:
I have a SharePoint List named Travel Requests. This list contains the below fields.
| Column Name | Data Type |
| Trip Title | This is a Title column with a single line of text. I just renamed it to “Trip Title” |
| Destination | Choice |
| Travel Start Date | Date and time |
| Travel End Date | Date and time |

- There is a Gallery control in Power Apps. This gallery displays each record from the SharePoint list based on the current Year.

To achieve the above example, follow the below steps. Such as:
- Insert a Gallery control [gal_CurrentYearTrips] and set its Items property to the code below.
Items = With(
{
StartDate: Date(
Year(Today()),
1,
1
),
EndDate: Date(
Year(Today()),
12,
31
)
},
Filter(
'Travel Requests',
'Travel Start Date' >= StartDate,
'Travel End Date' <= EndDate
)
)Where,
- With() = This function can help us to evaluate a formula for a single record
- StartDate, EndDate = Power Apps Scope Variables
- Date() = This function is used to convert individual Year, Month, and Day values to a Date/Time value
- Year() = This function returns the year component of a Date/Time value
- Today() = Power Apps Today() helps to get the current date
- ’12’, ’31‘ = 12 for the number of months and 31 for the number of days in a month
- ‘Travel Requests’ = SharePoint Online List
- ‘Travel Start Date’, ‘Travel End Date’ = SharePoint date columns

- Save, Publish, and Preview the app. The gallery will display the filtered records, i.e., [Current Year Records], as in the screenshot below.
This is how to filter a Power Apps gallery by the current year.
Filter Power Apps Gallery By Next Year
Next, we will see how to filter a Power Apps gallery by the next or upcoming year.
- In Power Apps, there is a Horizontal Gallery control. This gallery displays each record from the SharePoint list based on the next or upcoming year.
Refer to the below image:

To work around this example, follow the below-mentioned steps. Such as:
- Insert a Gallery control and set its Items property as:
Items = With(
{
StartDate: Date(
Year(Today())+1,
1,
1
),
EndDate: Date(
Year(Today())+1,
12,
31
)
},
Filter(
'Travel Requests',
'Travel Start Date' >= StartDate,
'Travel End Date' <= EndDate
)
)Where,
- Year(Today())+1 = This function returns the year component of a Date/Time value, whereas ‘1’ is used for the next year

- Save, Publish, and Preview the app. The gallery will display the filtered records, i.e., [Next Year Records], shown below.
This is how to filter a Power Apps gallery by next/upcoming year.
Power Apps Filter Gallery By Next N Years
Let’s see how to filter the Power Apps gallery by the next N number of Years.
- In Power Apps, there is a Vertical Gallery control. This gallery filters and displays each record from the SharePoint list based on the next two years from the current year.

To do so, follow the below steps.
- Insert a Gallery control and set its Items property to the code below.
Items = With(
{
StartDate: Date(
Year(Today()),
Month(Today()),
Day(Today())
),
EndDate: Date(
Year(Today()) + 2,
Month(Today()),
Day(Today())
) - 1
},
Filter(
'Travel Requests',
'Travel Start Date' >= StartDate,
'Travel End Date' <= EndDate
)
)Where,
- Year(Today()) = This function returns the year component of a Date/Time value
- Month(Today()) = This function returns the month component of a Date/Time value
- Year(Today()) + 2 = 2 is number of next years // You can change No of years
Refer to the below screenshot:

- Save, Publish, and Preview the app. The gallery will display the filtered records, i.e., [Next 2 years records], as shown below.
This is all about how to filter a Power Apps gallery by the next/upcoming N years.
Filter Power Apps Gallery By Last Year
Similarly, here we will see how to filter a Power Apps gallery by the previous year.
- In the screenshot below, you can see the Power Apps gallery displays each record from the SharePoint list based on the last or previous year.

- Insert a Gallery control and set its Items property as:
Items = With(
{
StartDate: Date(
Year(Today())-1,
1,
1
),
EndDate: Date(
Year(Today())-1,
12,
31
)
},
Filter(
'Travel Requests',
'Travel Start Date' >= StartDate,
'Travel End Date' <= EndDate
)
)Where,
- Year(Today())-1 = This function returns the year component of a Date/Time value, and ‘1’ is used for the previous/last year
Refer to the below image:

- Save, Publish, and Preview the app. The gallery will display the filtered records, i.e., [Last Year Records].
This is how to filter a Power Apps gallery by last year.
Filter Power Apps Gallery By Previous N Years
Finally, I will show you how to filter a Power Apps gallery by previous N years (for example last 4 years data).
- The below Power Apps gallery displays each record from the SharePoint list based on the previous four years.

To work around the above example, follow the below steps.
- Insert a Gallery control and set its Items property code like below.
Items = With(
{
StartDate: Date(
Year(Today())-4,
Month(Today()),
Day(Today())
)+ 1,
EndDate: Date(
Year(Today()),
Month(Today()),
Day(Today())
)
},
Filter(
'Travel Requests',
'Travel Start Date' >= StartDate,
'Travel End Date' <= EndDate
)
)Where,
- Year(Today())-4 = This function returns the year component of a Date/Time value, and 4 is the number of previous years // You can change the number of years
Refer to the below screenshot:

- Save, Publish, and Preview the app. The gallery will display the filtered records, i.e., [Last Four Years Records]
This is all about the Power Apps filter gallery by previous/last N years.
Also, you may like some more Power Apps tutorials:
- Power Apps Filter Gallery By Days
- Power Apps Filter Gallery By Week
- Power Apps Filter Gallery By Date
- Power Apps Filter Gallery By Quarter [With Examples]
I hope this article helped you to learn how to filter Power Apps gallery by current year, next year, previous year.
Additionally, we saw how to filter Power Apps gallery by next N years and previous N years with examples.

Preeti Sahu is an expert in Power Apps and has over six years of experience working with SharePoint Online and the Power Platform. She is the co-author of Microsoft Power Platform: A Deep Dive book. As a Power Platform developer, she has worked on developing various tools using Power Apps and Power Automate. She also makes Microsoft 365 videos and shares them on YouTube.