Filter for “Not In” Scenarios in Power Apps

Power Apps is equipped with a lot of great functions. Unfortunately, Not In is not an available function but there are ways to get the same result.

In the example below, there are a list of users in a gallery. The list is displayed by the following code entered in the Items box for the gallery:

Office365Users.SearchUser({searchTerm:txtSearch.Text})

where txtSearch is the name of my search field. Swap the name of my search field with yours.

This code means that all Office365 users are shown by default but if someone types a name in the txtSearch box, the gallery will then display the applicable results, only.

The default list and any search results will include users with a job title of “None” along with all other users. I need to exclude the users with the job title “None” from this gallery. Though Power Apps does not have a Not In function, I can still exclude these users from the gallery with the Filter function and an operator by using this code:

Filter(Office365Users.SearchUser({searchTerm:txtSearch.Text}),"None" <> JobTitle)

This way the default list of users and any search results is displayed without including those with “None” as a job title.

Super easy! I hope this topic helps you make even better apps.