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 / ForAll With Collection...
Power Apps
Answered

ForAll With Collection and Filter

(0) ShareShare
ReportReport
Posted on by 641

Hello All,

 

There are : District Code - 5

Sites in district- (In SiteDetails table) - 11,12,13,14 where district Code is=5, and 15,16... where district code is 6 and so on....

User`s in User Table - Based on Sites - like -

Site ID  User Name

11  - User1

11 -User 2

12 - User 3

13- User 4

14 - User 5

14- User 6

15- User 7

16- User 7.

 

Now my requirement is- i have only district code and I want all users (while belong to District->Site->Users)

 

Can anyone please help.

 

Thanks,

 

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,127 Most Valuable Professional on at

    Hi @panand99 ,

    Firstly I do not know your exact field names, so you may have to adjust the below. Also I have assumed the number of records in Site Details is less than your (500-2000) delegation limit as the With() statement is to avoid Delegation issues.

    With(
     {wSites:SiteDetails},
     Filter(
     'User Table',
    	 'Site ID' = Lookup(
     wSites,
     District=YourDistrictValue
     ).Site
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • panand99 Profile Picture
    641 on at

    Thanks for your response @WarrenBelz 

    but this does not solve my problem.

    My requirement is that I want to show all users which were belong to the district on click of action button.

     

    I used below formula to acheive-

     

    ForAll(AllSitesInDistrict,
    Collect(collUsersInSite,Filter(UserSites,SiteCode="<siteID to pass here>")))

     

    If I used this formula without ForAll, it will gives me exact users which are in one site. but when I add ForAll to fetch all users for all sites the Inner Filter function not works.

     

    the error is - "The specified column not accessible in this context"

     

     

  • WarrenBelz Profile Picture
    156,127 Most Valuable Professional on at

    @panand99 ,

    Can you please send a brief couple of tables with the actual site and field names and what matches them together.

  • Verified answer
    panand99 Profile Picture
    641 on at

    Thanks for the support @WarrenBelz 

     

    i just figured it out the issue, use of ambiguation  (@) in Filter of user sites solve my issue.

     

    ForAll(AllSitesInDistrict,
    Collect(collUsersInSite,Filter([@UserSites],SiteCode="<siteID to pass here>")))

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 166

#3
sannavajjala87 Profile Picture

sannavajjala87 71 Super User 2026 Season 1

Last 30 days Overall leaderboard