Have you ever filtered Power Apps Gallery or Data table control by multiple person columns? Ok, no worries!
This Microsoft Power Apps tutorial will explain everything about how to filter multiple person column in Power Apps with a simple scenario.
How to Filter Multiple Person Column in Power Apps
Let’s explore it.
Scenario:
I have a SharePoint Online list named “Travel Requests” and this list contains the below fields.
Column Name | Data Type |
Trip Title | It is a default single line of text |
Airline | Choice |
Travel Start Date | Date and time |
Travel End Date | Date and time |
Requester | Person or Group |
Estimated Airfare | Currency |
Refer to the below image:
In the SharePoint person or Group Column [Requester], you must select “Allows multiple selections” as shown below.
In Power Apps, there is a ComboBox control, a Serch icon, and a Gallery control. As seen in the screenshot below, the Gallery control shows each record from a SharePoint list based on the Person filed multiple selections using the search icon.
To work around this, follow the below-mentioned steps. Such as:
1. Open Power Apps -> Create a Blank canvas app and connect it to the respective SharePoint list [Travel Requests] like below.
2. Also, connect the app to the Office365Users shown below.
3. Now, insert a Search icon and set its OnSelect property to the code below.
OnSelect = ClearCollect(
colTravels,
'Travel Requests'
);
Collect(
colRequesters,
Filter(
colTravels,
User().Email in Requester.Email
)
)
Where,
- colTravels = Power Apps Collection Name
- ‘Travel Requests’ = SharePoint Online List
- colRequesters = Second Power Apps collection
- Filter() = This function is used to filter each record from a data source based on the formula
- Requester = SharePoint Person or Group Field
4. Next, insert a ComboBox control and set its Items property as:
Items = Office365Users.SearchUser({SearchTerm: ComboBox_Requesters.SearchText}).DisplayName
Where,
- Office365Users = Office365Users Datasource
- ComboBox_Requesters = Power Apps ComboBox Name
- SearchTerm = Power Apps Variable Name
5. Once, you added the Office365Users, the ConboBox control will display all Office356Users as in the screenshot below.
6. Then, insert a Gallery control and set Its Items property as:
Items = colRequesters
Where,
- colRequesters = Power Apps Collection Name
7. Once your app is ready, Save, Publish, and preview the app. When the user selects multiple users from a ComboBox control and clicks on the search icon, the Gallery control will filter and display each record from a SharePoint list based on the multiple-person field selection, as in the screenshot below.
This is all about filtering multiple-person columns in the Power Apps app.
Conclusion
I hope this Microsoft Power Apps tutorial taught in detail information about how to filter multiple person column in Power Apps with a simple scenario.
Also, you may like some more Power Apps tutorials:
- Filter a Collection Based On Another Collection in Power Apps
- Power Apps Filter Gallery By Year
- Power Apps Filter Gallery By Last Month
- Remove a Column from Power Apps Collection
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com