How to Apply Multiple Filters On Power Apps Gallery?

One of my clients requested me to build a leave management application in Power Apps. That application has a screen displaying all employee leave requests for Approver people, such as the HR manager. Here, I got a requirement to filter the gallery based on Employee names and dates.

In this article, I will explain how to apply multiple filters on the Power Apps gallery.

Apply Multiple Filters On Power Apps Gallery

In the example below, you can see both employee names and dates filter the gallery. Here, I took employee names from Microsoft 365 users.

power apps filter gallery with multiple conditions

Here is the SharePoint list named Employee Leave Requests used for the above Power Apps gallery.

power apps filter gallery by person field

To achieve this, follow the steps below!

1. Connect Power Apps with SharePoint list. Then, add a Combo box control and put the formula below in its Items property.

Office365Users.SearchUser({searchTerm:cmb_EmpName.SearchText}).DisplayName

Here, cmb_EmpName is the combo box control name. This formula displays all Microsoft 365 users’ display names in combo box control. You can easily search for the employee’s name here.

power apps filter gallery by combobox selection

2. Add a Power Apps Date Picker control and a Reload Icon. In the OnSelect property of the reload icon, provide the formula below.

Reset(dtp_StartDate)

We use this formula to filter the Power Apps gallery to reset the date picker control.

how to filter power apps gallery based on multiple conditions

3. Add a Power Apps gallery control and provide the formula below in its Items property:

If(
     !IsBlank(dtp_StartDate.SelectedDate) && !IsBlank(cmb_EmpName.Selected),
        Filter(
            'Employee Leave Requests',
            'Employee Name' = cmb_EmpName.Selected.DisplayName &&
            'Start Date' = dtp_StartDate.SelectedDate
        ),
        !IsBlank(dtp_StartDate.SelectedDate),
        Filter(
            'Employee Leave Requests',
            'Start Date' = dtp_StartDate.SelectedDate
        ),
        !IsBlank(cmb_EmpName.Selected),
        Filter(
            'Employee Leave Requests',
            'Employee Name' = cmb_EmpName.Selected.DisplayName
        ),
        'Employee Leave Requests'
    )

Here,

  • dtp_StartDate = Date picker control name.
  • cmb_EmpName = Combo box control name.
  • Employee Leave Requests = SharePoint list name.

This formula filters the Power Apps gallery based on three conditions.

  • The gallery will be filtered based on the combo box and date picker selection.
  • Based on the combo box selection.
  • Based on the date picker selection.
  • If we don’t select any option by default, it will display all employee leave requests.

Save the changes and preview the app once. While selecting the employee name in the combo box, you can see that it filters the Power Apps gallery. If we select only the date, the gallery will also be filtered based on that selection. If we choose both the combo box and the date value, the gallery will be filtered based on two values.

I hope you understand how to apply multiple filters on the Power Apps gallery.

Additionally, you may like some more Power Apps articles:

>