web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter Multiple Users ...
Power Apps
Answered

Filter Multiple Users of a Gallery in PowerApps

(0) ShareShare
ReportReport
Posted on by 138

Hi guys,

 

I am trying to Filter two or more users within a Gallery on PowerApps.

The code I have is:

Filter(
 Office365Users.SearchUser(
 {
 searchTerm: "John" Or "Bob",
 top: 500
 }
 ),
 AccountEnabled = true
)

It doesn't work if I place the And/Or into it and I don't want a search box.

Is there a way to searchTerm more than one name and they will appear in the Gallery?

 

Thanks in advance.

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    69,560 Most Valuable Professional on at

    There isn't support for multiple search terms, but you can use the function without a search term and then filter based on one of the Fields like this

    Filter(Office365Users.SearchUser(),GivenName="Carla" Or GivenName="Paul")
  • Andy_Prog Profile Picture
    138 on at

    @Pstork1 Hi,

     

    Thank you for replying.

    That function didn't work sadly.

     

    Regards,

     

    Andrew

  • Pstork1 Profile Picture
    69,560 Most Valuable Professional on at

    Not sure why it would work for me, but not for you.  It may be a problem with delegation since I don't have more than 500 users in my tenant.

  • Verified answer
    Andy_Prog Profile Picture
    138 on at

    @Pstork1 

    No luck, I have placed some "Not" statements for some departments and chose the relative users by using an if statement. To retrieve the other users I embedded an if statement within the above if statement and 2 other if statements within each other.

    Not the most ideal way of doing it but it worked.

    Filter(
     Office365Users.SearchUser(
     {
     searchTerm: "",
     top: 500
     }
     ),
     Not("Dep1" in Department),
     Not("Dep2" in Department),
     Not("Dep3" in Department),
     Not("Dep4" in Department),
     Not("Dep5" in Department),
     Not("Dep6" in Department),
     Not("DisName1" in DisplayName),
     Not("DisName2" in DisplayName),
     Not("DisName3" in DisplayName),
     Not("DisName4" in DisplayName),
     Not("DisName5" in DisplayName), Not("DisName6" in DisplayName), Not("DisName7" in DisplayName),Not("DisName8" in DisplayName), Not("DisName9" in DisplayName),
     Not IsBlank(Department),
     AccountEnabled = true,
     If(DisplayName = "Name1", true,
     If(
     DisplayName = "Name2", true,
     If (
     DisplayName = "Name3", true,
     If (
     DisplayName = "Name4", true
     )
     )
     )
     )
    )

    Thanks for the advice.

     

    Andrew

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 342 Most Valuable Professional

#2
11manish Profile Picture

11manish 234

#3
Valantis Profile Picture

Valantis 187

Last 30 days Overall leaderboard