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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Apps
Answered

Nested Filters

(0) ShareShare
ReportReport
Posted on by 38

Hello dear power apps community,

 

I'm having a problem with filtering 2 lists against each other. I've got a list 1, where I have employee data and a list 2 where I have department data. Then I've got a list 3, where I collect likes from users of list 1 to users from list 2.

List 1

Employee dataEmail
...(functions as ID)

List 2 

department datadepartmentID
...1 to N

List 3

Employee EmaildepartmentID
xxx@example.com1 to N

 

I want to make a filter that finds an random element from list 2, that are not liked from the active user (list 3).

My try was to Filter(List2; IsBlank(LookUp(List3; Employee Email=Office365Users.MyProfil().Mail && DepartmentID=List2.DepartmentID)

But this last part doesn't really work, since I can't reference the first filter inside the LookUp.

For randomization I actually got an algorithm:

First(SortByColumns(AddColumns(Filter(See above);"Random";Rand());"Random")

 

It would be really helpful If someone found an solution for this problem. Thanks in advance!

Categories:
I have the same question (0)
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @Elias_Gda,

     

    Are you trying to access the DepartmentID column from the current List2 filter record? Should this be the case, can create an explicit record scope via 'As':

    Filter(
     List2 As Main; 
     IsBlank(
     LookUp(
     List3; 
     //Preferably the office365... value should be stored in a variable and the variable should be referenced
     'Employee Email' = Office365Users.MyProfileV2().mail,
     DepartmentID = Main.DepartmentID
     )
     )
    )

     

    Alternative in which you limit the amount of API calls:

    With(
     {
     wList3Ids: Filter(
     List3; 
     //Preferably the office365... value should be stored in a variable and the variable should be referenced
     'Employee Email' = Office365Users.MyProfileV2().mail,
     DepartmentID = Main.DepartmentID
     ).DepartmentID 
     },
     Filter(
     List2; 
     !(DepartmentID in wList3Ids)
     )
    )

     

    To get a random record, you could also use the Shuffle function:

    First(
     Shuffle(
     //Filter statement (opt1) or With statement (opt2)
     )
    )

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • EG-05090855-0 Profile Picture
    38 on at

    That was it! I didn't know the functions "As" and "Shuffle", thanks for showing me

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard