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 Platform Community / Forums / Power Apps / Filter/Group By from a...
Power Apps
Answered

Filter/Group By from a different list and collection

(0) ShareShare
ReportReport
Posted on by 997 Super User 2024 Season 1

Hi, I have this collection, NewSubordinates that is filtered according to the Manager's Name.

anonymous21_0-1659949912916.png

I need to check who's the approver(s) for each of the subordinates inside the collection. To check the subordinates' approver(s), it is in another list, the Employee list.

anonymous21_1-1659950056395.png

Name, Manager's Name, Approver Level 1 and Approver Level 1 are people columns.

I also need to check whether the subordinates have 1 or more approvers to create the approval for the specific subordinate.

//App.OnStart
With(
 {
 ApproverName:
 Filter(
 Employee,
 'Approver Level 1' And 'Approver Level 2'
 ),
 EmpName:
 Filter(
 NewSubordinates, Requester.DisplayName)
 },
 
 First(ForAll(
 ApproverName As aCol,
 Collect(
 Newcollect,
 Filter(
 EmpName,
 Requester.DisplayName = aCol.'Approver Level 1' && aCol.'Approver Level 2'
 )
 )
 )
));

I tried this formula but it doesn't work. How to get the who's the approver(s) for the subordinates?

 

Thank you.

 

Categories:
I have the same question (0)
  • BCBuizer Profile Picture
    22,510 Super User 2025 Season 2 on at

    HI @syhrh ,

     

    Can you please share the code you use to create the NewSubordinates collection? I'm sure it will be easier to add a column / columns that have the approver data in there than it is to create two different collections.

  • syhrh Profile Picture
    997 Super User 2024 Season 1 on at

    @BCBuizer 

    //App.OnStart
    With(
     {
     wSub:
     Filter(
     Employee,
     'Manager''s Name'.Email = User().Email
     ),
     wLeave:
     Sort(
     Test, 
     ID,
     Descending
     )
     },
     
     First(ForAll(
     wSub As aCol,
     Collect(
     NewSubordinates,
     Filter(
     wLeave,
     Requester.DisplayName = aCol.Name.DisplayName && Status.Value="Pending" 
     )
     )
     )
    ));
  • BCBuizer Profile Picture
    22,510 Super User 2025 Season 2 on at

    Hi @syhrh ,

     

    The below modified code will add two columns to the NewSubordinates collection: "Approver Level 1" and "Approver Level 2" for which the value is pulled from aCol (= wSub) = Employee)).

     

    //App.OnStart
    With(
     {
     wSub:
     Filter(
     Employee,
     'Manager''s Name'.Email = User().Email
     ),
     wLeave:
     Sort(
     Test, 
     ID,
     Descending
     )
     },
     
     First(ForAll(
     wSub As aCol,
     Collect(
     NewSubordinates,
    			AddColumns(
    			 Filter(
    				wLeave,
    				Requester.DisplayName = aCol.Name.DisplayName && Status.Value="Pending" 
    			 ),
    			"Approver Level 1",
    			LookUp(aCol, Requester.DisplayName = aCol.Name.DisplayName, 'Approver Level 1')
    			"Approver Level 2",
    			LookUp(aCol, Requester.DisplayName = aCol.Name.DisplayName, 'Approver Level 2')
     )
     )
    ));
  • syhrh Profile Picture
    997 Super User 2024 Season 1 on at

    @BCBuizer 

    I got this error

    anonymous21_0-1660265072763.png

     

  • Verified answer
    BCBuizer Profile Picture
    22,510 Super User 2025 Season 2 on at

    Hi @syhrh ,

     

    //App.OnStart
    With(
     {
     wSub:
     AddColumns(
    		 Filter(
    			 Employee,
    			 'Manager''s Name'.Email = User().Email
    		 ),
    		 "EmployeeDisplayName",
    			Name.DisplayName
    		),
     wLeave:
    		AddColumns(
    		 Sort(
    			 Test, 
    			 ID,
    			 Descending
    		 ),
    		 "RequesterDisplayName",
    		 Requester.DisplayName
     },
     
    	ForAll(
     wSub,
     Collect(
     NewSubordinates,
    			AddColumns(
    			 Filter(
    				wLeave,
    				RequesterDisplayName = EmployeeDisplayName && Status.Value="Pending" 
    			 ),
    			"Approver Level 1",
    			LookUp(wSub, EmployeeDisplayName = RequesterDisplayName, 'Approver Level 1')
    			"Approver Level 2",
    			LookUp(wSub, EmployeeDisplayName = RequesterDisplayName, 'Approver Level 2')
     )
     )
    );

     

  • BCBuizer Profile Picture
    22,510 Super User 2025 Season 2 on at

    Hi @syhrh ,

     

    Did my post resolve your issue? If yes, please mark it as the solution for the benefit of the community. If not, please let me know what you are running into.

  • syhrh Profile Picture
    997 Super User 2024 Season 1 on at

    @BCBuizer Sorry for the late reply. Yes, it does what I need. Thank you!

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 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard