How to Filter Power Apps Gallery by Person? [With Various Examples]

Recently, I developed a leave management application with two key features: Employees can view only their leave requests, while approvers have a separate screen to see all employees’ leave requests. Additionally, approvers can filter requests by a specific employee using the person field.

In this tutorial, I will explain how to filter Power Apps gallery by person. Additionally, we will discuss the topics below:

  • Filter Power Apps gallery by current user
  • Power Apps filter gallery by multiple person fields
  • Power Apps filter gallery by SharePoint created by field

Filter Power Apps Gallery by Current User

Here, we’ll see how to filter Power Apps gallery items based on the current user. The Employee Leave Requests SharePoint list below shows the leave requests of various people.

On the Employee Name field, you can see the various employee names.

powerapps filter gallery by current user

This SharePoint list contains the following fields.

Column NameData Type
Leave TitleSingle line of text
Employee NamePerson
Submitted DateDate& Time
Start DateDate& Time
End DateDate& Time
Team LeadPerson
Leave TypeChoice(Annual Leave, Sick Leave, Compassionate, Maternity Leave)
DepartmentChoice(Information Technology, HR, Marketing, Sales)
In the Power Apps gallery, you can see only the current user leave requests.
filter gallery by current user powerapps

Follow the steps below to achieve this!

1. Connect the Power Apps application with the SharePoint list. Then, add a Vertical gallery control from the +Insert tab.

powerapps filter gallery by person field

2. Provide the formula below on the Items property of the gallery control.

Filter('Employee Leave Requests','Employee Name'.DisplayName=User().FullName)

Here, the Power Apps Filter function filters the current user leave requests.

  • ‘Employee Leave Requests’ = SharePoint list name.
  • ‘Employee Name’ = SharePoint list field name.
  • User().FullName = Returns the current user’s full name.
filter power apps gallery with person field

Now, save the changes and preview the app. The gallery control contains only current user leave requests, as in the above image.

Filter Power Apps Gallery Control with Person Field

In the example below, you can see the gallery contains all employees’ leave requests, and selecting the employee name in the combo box controls filters the gallery control.

how to filter power apps gallery with person name picker

Follow the steps below to achieve this!

1. Add a Combo box control and provide the formula below in its Items property.

Choices([@'Employee Leave Requests'].'Employee Name')

It fetches all employee names into combo box control.

power apps filter gallery by combobox of person field

2. Add a vertical gallery control and provide the formula below in its Items property.

Filter('Employee Leave Requests','Employee Name'. Display Name = cmb_employee Names.Selected.DisplayName)

This Formula filters the gallery control when the employee name and comb box selected name match.

power apps filter gallery with a people picker

Now, save the changes and preview the app. Like in the above intro example, the combo box filtered employee leave requests will be displayed in gallery control.

Filter Power Apps Gallery With Multiple Person Fields

In the example below, you can see the gallery control is filtering based on the two-person fields on the SharePoint list. The two SharePoint list person fields are:

  • Employee Name
  • Team Lead

If both combo box controls are empty, the gallery control displays all employee leave requests.

If we select only the employee name in the combo box, it filters based on that name; if we select both team lead and employee, it filters based on the selected names.

filter power apps gallery with multiple person fields

Follow the steps below to achieve this!

1. In Power Apps, add another combo box control for team lead and provide the below formula in its Items property to fetch team lead names.

Choices([@'Employee Leave Requests'].'Team Lead')
powerapps filter gallery by multiple person field

2. Add the gallery control and provide the formula below for its Items property.

If(
    IsBlank(cmb_employeeNames.Selected.DisplayName) && IsBlank(cmb_TeamLead.Selected.DisplayName),
    'Employee Leave Requests', // Show all leave requests if both combo boxes are empty
    If(
        !IsBlank(cmb_employeeNames.Selected.DisplayName) && !IsBlank(cmb_TeamLead.Selected.DisplayName),
        Filter(
            'Employee Leave Requests',
            'Employee Name'.DisplayName = cmb_employeeNames.Selected.DisplayName &&
            'Team Lead'.DisplayName = cmb_TeamLead.Selected.DisplayName
        ),
        If(
            !IsBlank(cmb_employeeNames.Selected.DisplayName),
            Filter(
                'Employee Leave Requests',
                'Employee Name'.DisplayName = cmb_employeeNames.Selected.DisplayName
            ),
            Filter(
                'Employee Leave Requests',
                'Team Lead'.DisplayName = cmb_TeamLead.Selected.DisplayName
            )
        )
    )
)
  • If only the employee’s name is selected in the combo box, the gallery control displays the leave requests of the selected employee; the same is true for the team lead.
  • If we select both the employee’s and team lead’s names, gallery filters will be based on these two names.
  • If none is selected, then it will display all employee leave requests.
how to filter power apps gallery with multiple person name picker

Save the changes and preview the app once.

Power Apps Filter Gallery by SharePoint Created By Field

Let’s filter the Power Apps gallery with the created by SharePoint list person field. You can see the Created By Person field in the SharePoint list below.

powerapps filter gallery by current user and created by

In the example below, you can see the gallery filtering employee leave requests, where the person name created by the field matches the current user.

powerapps filter gallery by created by person field

To achieve this, provide the formula below in the Items property of the Power Apps gallery control.

Filter('Employee Leave Requests','Created By'.DisplayName=User().FullName)
  • ‘Created By’ = SharePoint list field name.
  • User().FullName = Returns the current user’s full name.
powerapps filter gallery by created by

This way we can filter the Power Apps gallery using the SharePoint list person field.

I hope you understand how to filter the Power Apps gallery with the person field. In this article, I have shown various examples of filtering the Power Apps gallery with person fields, such as based on the current user, created by, and multiple person fields.

Follow this article while trying to filter the Power Apps gallery based on the person field; if you have different field names in the SharePoint list, just change those names in the formulas I have provided above.

Also, you may like:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…