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 Officer365Users...
Power Apps
Answered

Filter Officer365Users by department

(0) ShareShare
ReportReport
Posted on by

Hi,

 

I would like to include in the people picker users that match some departments only but I'm unable to do so 

I tried to use 

Filter(Office365Users.SearchUser({searchTerm:PeoplePicker_3.SearchText}),!IsBlank(JobTitle)&&!IsBlank(Mail)&&!IsBlank(Department)&&
("AB Department" in Department ||
"BC Department" in Department ||

"XY Department" in Department
)
)

 

But no luck. Any idea what I'm doing wrong. It is working if I only include one department in the filter

 

 

Categories:
I have the same question (0)
  • mahoneypat Profile Picture
    1,720 on at

    Please see if this syntax works.

    Filter(Office365Users.SearchUser({searchTerm:PeoplePicker_3.SearchText}),!IsBlank(JobTitle)&&!IsBlank(Mail)&&!IsBlank(Department)&&
    Department in ["AB Department", "BC Department", "XY Department"]

    )  

    Pat

     

  • indhaa Profile Picture
    on at

    It shows as invalid syntax

     

  • mahoneypat Profile Picture
    1,720 on at

    I tried it out successfully on my end.  I must have keyed something in wrong.  I made a button that created a collection with similar structure below

     

    ClearCollect(colEmployees, Table({Name: "Joe", Title: "Manager", Department: "A"}, {Name: "Mary", Title: "Director", Department: "B"}, {Name: "Tom", Title: "Manager", Department: "C"}, {Name: "Joe", Title: "Manager", Department: "C"}))

     

    And then Filtered it in a gallery.

     

    Filter(colEmployees, !IsBlank(Name) && !IsBlank(Title) && Department in ["A", "B"])

     

    Regards,

    Pat

  • indhaa Profile Picture
    on at

    My data connection is to Office365Users and filtering the users using that. Not using a gallery

    Any idea how to filter within my data source 

     

    @RandyHayes 

  • Verified answer
    indhaa Profile Picture
    on at

    I tried with this. It is working now Filter(Office365Users.SearchUser({searchTerm:ComboBox1.SearchText}),"AB" in Department || "CD" in Department || "DE" in Department || "FG" in Department)

     

     

  • indhaa Profile Picture
    on at

    Seem the issue was there was a spelling mistake when naming the department. That's why it was not working before. Thanks for the help @mahoneypat 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 529 Most Valuable Professional

#2
Haque Profile Picture

Haque 230

#3
Kalathiya Profile Picture

Kalathiya 217 Super User 2026 Season 1

Last 30 days Overall leaderboard