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 a list based...
Power Apps
Answered

Filtering a list based on Lookup Column and its related columns.

(0) ShareShare
ReportReport
Posted on by 4

Hi,

 

I have two lists,

 

ListA has Title and a lookup column(Department from listB) with multiple items allowed

 

ListB has Department(text) and Leader(Person)

 

In ListA you can create a record and list all departments which might follow this record.

 

in PowerApps i have a gallery i want to filter records in listA based on which records the department the logged-in user is leader for which is found in listB.

 

i tried setting a variable on visible that does lookup on logged in user and stores the department value in that variable

 

then on the filtering of the gallery i tried

Filter(ListA, variable in ‘LookupColumn’)

 

but that gave me an error «Invalid schema, expected a one column table»

 

Am I missing something or is what i am trying to do just a really silly way of doing it in the first place?

 

thanks

Categories:
  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Mundzen,

    Do you want to filter ListA based on current user in the Leader column from the List B?

    Do you have this LookUp column allowing multi select?

     

    Set the Items property of the Gallery as below:

    Filter(
     ListA,
     CountRows(
     Filter(
     ForAll(
     DepLookUp,
     If(
     Value in Filter(
     ListB,
     Leader.Email = User().Email
     ).Department,
     {t: 1},
     {t: 0}
     )
     ),
     t = 1
     )
     ) > 0
    )
  • Mundzen Profile Picture
    4 on at

    I have a button called «Following» on a list (listA) which i want to filter the records based on which records the department is following. These departments is located in ListB with a column specifying its leader. The lookup column in listA is set to allow multiple selections from listB.

     

    So in my head i reckon the logic to be

    1) figure out which department the logged in user is leader for

    2) filter the records based on that department from the lookup column

     

    i will try your solution when i get back to the office. But got a bit confused by the countrows bit?

    Thanks for replying

     

    Update: I tried your solution and it did exactly what I wanted @v-qiaqi-msft! Thank you so much! I still dont understand why it works however, lol. If you wouldn't mind, could you perhaps explain the logic? Are the matching rows being stored in CountRows?

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard