How to Filter Power Apps Collection By Date?

Did you know how to filter Power Apps Collection by Date? If Not, No Worries!

In this Power Apps tutorial, I will filter the Power Apps collection by SharePoint Date column and many more below:

  1. How to filter Power Apps collection based on the selected date from two date picker controls
  2. Power Apps filter collection by date range
  3. Power Apps filter collection today by date column
  4. Power Apps filter collection by the current year

How to Filter Power Apps Collection By Date

I will show you how to filter the collection by SharePoint date column.

For Example:

I have a SharePoint Online list as ” Loan Approval,” which has different columns like:

Column NameData Type
User NameTitle
Loan TypeChoice [“Car Loan,” “Gold Loan,” “Home Loan“]
SalaryCurrency
Credit ScoreNumber
Loan Start DateDate and time
Approved or notYes/no
Loan End DateDate and time
ID ProofImage

Refer to the image below:

Power Apps filter collection by date column

I created a Power Apps canvas app and then added a Date picker control, a Button control, and a Gallery control.

The date picker control is connected to a SharePoint list date column [“Loan Applied Date“]. When a user selects a particular date from a date-picker control and clicks on a button, the gallery will filter and display the result based on the selected date.

I selected a date as “8/16/2023” from the date-picker control and clicked a search button. The gallery will filter and display the records based on a particular date.

Power Apps Filter collection by date column SharePoint online list

Follow the below steps to achieve it:

  • On the Power Apps screen, Insert a Date picker control.
  • Insert a Button control -> Set its OnSelect property to:
ClearCollect(
    coldate,
    Filter(
        'Loan Approval',
        'Loan Applied Date' = Date(
            Year(dte_LoanStartDate.SelectedDate),
            Month(dte_LoanStartDate.SelectedDate),
            Day(dte_LoanStartDate.SelectedDate)
        )
    )
)

Where,

  1. coldate = New collection name
  2. Loan Approval = SharePoint list name
  3. Loan Start Date = SharePoint list date column name
  4. dte_LoanAppliedDate = Date picker name.
How to filter Power Apps collection by date column from SharePoint online list
  • Now insert a Gallery control -> Set its Items property to:
coldate
Power Apps Filter collection by date column SharePoint list
  • Save, Publish, and Preview the app. When the user provides a particular date and clicks on a search button. The gallery control will filter and display the data based on a selected particular date.
How to Filter Power Apps Collection By Date

I achieved this by filtering the Power Apps collection using a SharePoint list date column.

Power Apps Filter Collection Between Date

This section will show you how to filter a Power Apps collection based on the selected date from a 2-date picker control.

Example:

I have created a Power Apps collection using the above SharePoint list. On the Power Apps screen, two Date-picker controls were added. When the user selects a particular date from both controls, the gallery will filter and display the specific records between those selected dates.

Power Apps filter collection between date

Let me show you how to achieve this:

  • On the Power App’s App OnStart property -> Provide the code to create a Power Apps collection from the SharePoint list.
ClearCollect(colLoanApproval, 'Loan Approval')

Where,

  1. colLoanApproval = Provide the Collection name
  2. Loan Approval = SharePoint list name
  • Insert two Date-picker controls as shown below:
Filter Power Apps collection between date
  • Insert a Gallery control -> Set its Items property to:
Filter(
    colLoanApproval,
    ThisRecord.'Loan Start Date' >= dte_StartDate.SelectedDate,
    ThisRecord.'Loan Start Date' < dte_EndDate.SelectedDate + 1
)

Where,

  1. dte_EndDate = Power Apps 2nd date picker control name
  2. dte_StartDate = Power Apps 1st date picker control name
  3. colLoanApproval = Collection name
  4. Loan Start Date = SharePoint list date column name
  • Once the app is ready, Save, Publish, and Preview the app. When the user selects a particular date from both date picker controls, the gallery will filter and display the specific records between those selected dates.
How to filter collection between date in Power Apps

We can achieve this by filtering the Power Apps collection based on the selected date from a 2-date picker control.

Power Apps Filter Collection by Date Range

Here, I will explain how to filter the Power Apps collection by date range.

For Example, On my Power Apps screen, I have added two Date picker controls:

  1. Loan Start Date
  2. Loan End Date

When the user selects a particular date from both the controls, the gallery will filter and display the specific records that fall between those selected dates of a date picker controls.

Power Apps filter collection by date range

Let me show you how to achieve this:

  • On the Power Apps screen, insert two Date-Picker controls as shown below:
How to filter Power Apps collection by date range
  • Insert a Gallery control -> Set its Items property to:
Sort(
    If(
        IsBlank(dte_LoanApproval_EndDate.SelectedDate),
        If(
            IsBlank(dte_LoanApproval_StartDate),
            colLoanApproval,
            Filter(
                colLoanApproval,
                'Loan Start Date' >= dte_LoanApproval_StartDate.SelectedDate
            )
        ),
        If(
            IsBlank(dte_LoanApproval_StartDate),
            Filter(
                colLoanApproval,
                'Loan Start Date' <= dte_LoanApproval_EndDate.SelectedDate
            ),
            Filter(
                colLoanApproval,
                'Loan Start Date' <= dte_LoanApproval_EndDate.SelectedDate,
                'Loan Start Date' >= dte_LoanApproval_StartDate.SelectedDate
            )
        )
    ),
    'Loan Start Date',SortOrder.Descending
   )        

Where,

  1. dte_LoanApproval_EndDate = Power Apps 2nd date picker control name
  2. dte_LoanApproval_StartDate = Power Apps 1st date picker control name
  3. colLoanApproval = Collection name
  4. Loan Start Date = SharePoint list date column name
Filter Power Apps collection by date range
  • Once the app is ready, Save, Publish, and Preview the app. When the user selects a particular date from both controls [“Loan Start Date” and “Loan End Date“], the gallery will filter and display the specific records that fall between those selected dates of a date picker controls.
How to filter collection by date range in Power Apps

This is how I filtered the Power Apps collection by date range.

Power Apps Filter Collection Today By Date Column

I will show you how to filter the Power Apps collection by today using the SharePoint list date column.

For Example,

On the Power Apps screen, I have added the next arrow icon. Whenever the user clicks the arrow icon, the gallery filters and displays the records that started today using the SharePoint list date column [“Loan Start Date“] as shown below:

Power Apps Filter Collection Today By Date Column

Let me show you how to achieve this:

  • On the Power Apps screen, insert a Next arrow icon -> Set its OnSelect property to:
ClearCollect(
    colToday,
    Filter(
        'Loan Approval',
        'Loan Start Date' >= Today(),
        'Loan Start Date' < DateAdd(
            Today(),
            1,
            TimeUnit.Days
        )
    )
)

Where,

  1. colToday = Provide the Collection name
  2. Loan Approval = SharePoint list name
  3. Loan Start Date = SharePoint list date column name
How to filter Power Apps collection today by date column
  • Insert a Gallery control -> Set its Items property to:
ColToday

Where,

  • colToday = Collection name
Filter Power Apps collection today by date column
  • Save, Publish, and Preview the app. Whenever the user clicks the arrow icon, the gallery filters and displays the records that started today using the SharePoint list date column [“Loan Start Date“].
How to filter collection today by date column in Power Apps

This is how I filtered the Power Apps collection by today using the SharePoint list date column.

Power Apps Filter Collection By Current Year

I will show you how to filter the Power Apps collection by the current year using the SharePoint list date column.

For Example,

I have created a blank canvas app and added a Button control. When the user clicks on the button, the Data table filters and displays the records that started this year and ended this year using the SharePoint list date columns [“Loan Start Date” and “Loan End Date“]

Power Apps Filter collection by current year

Follow the below steps to achieve this:

  • On the Power Apps screen, insert a Button control -> Set its OnSelect property to:
ClearCollect(colYear,
With(
    {
        StartDate: Date(
            Year(Today())-4,
            Month(Today()),
            Day(Today())
        )+ 1,
        EndDate: Date(
            Year(Today()),
            Month(Today()),
            Day(Today())
        )
    },
    Filter(
        'Loan Approval',
        'Loan Start Date' >= StartDate,
        'Loan End Date' <= EndDate
    )
)
)

Where,

  1. colYear = Provide the Collection name
  2. Loan Approval = SharePoint list name
  3. Loan Start Date = SharePoint list date column name
  4. Loan End Date = SharePoint list date column name
Filter Power Apps collection by current year
  • On the Power Apps screen, insert a Data Table -> Set its Items property to:
colYear

Where,

  1. colYear = Collection Name.
How to filter Power Apps collection by current year
  • Save, Publish, and Preview the app. Whenever the user clicks the button control, the gallery filters and displays the records that started in the current year and ended in the current year using the SharePoint list date columns.
Filter collection by current year in Power Apps

We can achieve this by filtering the Power Apps collection by the current year.

Conclusion

I hope this Power Apps tutorial helped you to filter the Power Apps collection by date column.

Moreover, I have explained how to filter a Power Apps collection based on the selected date from a 2-date picker control and many more:

  1. Power Apps filter collection by date range
  2. Power Apps filter collection today by date column
  3. Power Apps filter collection by the current year

Also, you may like some more Power Apps articles below: