cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
indhaa
Super User
Super User

Filter Officer365Users by department

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

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

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)

 

 

View solution in original post

6 REPLIES 6
mahoneypat
Solution Sage
Solution Sage

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

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about the Power Platform, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


It shows as invalid syntax

 

mahoneypat
Solution Sage
Solution Sage

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





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about the Power Platform, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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 

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)

 

 

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 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (5,161)