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
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (1,699)