Power Apps Filter Gallery Dates In Last Year

Filter a Power Apps gallery to show only dates in the last year.



Input

Calendar Dates is a SharePoint list with consecutive days starting 1/1/2018 and ending 12/31/2024 (2,557 rows)

TitleCalendarDate
Monday, January 1, 20181/1/2018
Tuesday, January 2, 20181/2/2018
Wednesday, January 3, 20181/3/2018
Thursday, January 4, 20181/4/2018
Friday, January 5, 20181/5/2018
Tuesday, December 31, 202412/31/2024


Code

Use this code in the Items property of a gallery.

With(
    {
        StartDate: Date(
            Year(Today())-1,
            1,
            1
        ),
        EndDate: Date(
            Year(Today())-1,
            12,
            31
        )
    },
    Filter(
        'Calendar Dates',
        CalendarDate >= StartDate,
        CalendarDate <= EndDate
    )
)


Output

Shows only rows with a date in the next year. Current date is 6/16/2021.

TitleCalendarDate
Wednesday, January 1, 20201/1/2020
Thursday, January 2, 20201/2/2020
Friday, January 3, 20201/3/2020
Saturday, January 4, 20201/4/2020
Sunday, January 5, 20201/5/2020
Thursday, December 31, 202012/31/2020

(366 rows)