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 / Filtering for two tabl...
Power Apps
Unanswered

Filtering for two tables for dropdown option

(0) ShareShare
ReportReport
Posted on by

I want to populate a drop down depending on the user is Admin or not from two tables:

1) SALESMAN: Columns ID(GUID), NAME(Single Line of Text) , LOCATION(Single Line of Text -showing all the locations Salesman Assigned to) and UserRole(Single Line of Text)
2) PERIOD: Columns ID(GUID), YEAR(Single Line of Text) , LOCATION(Single Line of Text-- Values are if admin then all the Locations from Period Table else as in the second argument,

like:

if (UserRole="Admin", Filter(Period, Year=Year dropdown) for the Location field, 
with({var_UserAssignedLocations: showcolumns(filter(Salesman, name=user().displayname),Location)}, filter(Period, year = YearDropDown.selected.value, Location in var_UserAssginedLocations)))

(Thanks Akshansh-Sharma for the very useful solution in this community for the second option)

 

How to best accomplish it, as some or the other error is being thrown for the if statement!

 

Categories:
I have the same question (0)
  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    hi @Geeam  you can try something like this code:

    If(
     UserRole = "Admin",
     Distinct(Period, LOCATION), // Filter for all locations if user is admin
     Filter(
     Distinct(Period, LOCATION),
     LOCATION in var_UserAssignedLocations && YEAR = YearDropdown.Selected.Value
     )
    )
  • Geeam Profile Picture
    on at

    Thanks a lot anandm08 for the quick response. I want year dropdown value for the admin also as Office Locations can change over the year. So need filter for the first argument too. Also, should I create var_UserAssginedLocations somewhere before as in the above example it is created by the With statement.

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

#2
11manish Profile Picture

11manish 168

#3
sannavajjala87 Profile Picture

sannavajjala87 75 Super User 2026 Season 1

Last 30 days Overall leaderboard