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 based on relate...
Power Apps
Unanswered

Filter based on related table/entity

(0) ShareShare
ReportReport
Posted on by 119

I want to show a gallery from table A but filter the results based upon a value of Column4 in a related table B.

 

eg.

 

TableA

Column1(PK), Column2, Column3(FK)

 

TableB

Column1(PK), Column2, Column3, Column4

 

In SQL, I would write

 

"select * from TableA inner join TableB on TableA.Column3=TableB.Column1 where TableB.Column4=N'X'"

 

How should I construct the filter formula in Powerapps?

Categories:
I have the same question (0)
  • v-yamao-msft Profile Picture
    on at

    Hi Graham,

     

    You could add a Dropdown control in your App, set its items property to TableB.Column4.
    Then add a Gallery control and set its Items property to If(IsBlank(TableA),Filter(TableA,Title=Dropdown1.Selected.Value)).

     

    Please try if this works for you.

     

    Best regards,
    Mabel Mao

  • rgruian Profile Picture
    on at

     

    Assuming the column names are accurate, that you are looking for an 'N' in Column4, and that there is indeed a name collision between the column names in TableA and TableB, here's how you can accomplish the operation you mentioned:

     

        gallery1.Items = Filter(TableA, Lookup(TableB, Column1 = TableA[@Column3].Id, Column4) = N)

     

    Note the row scope disambiguation syntax TableA[@Column3] is needed only because of the name collision apparent in your requirements. If TableA and TableB do not in fact have colliding column names, you can use the normal, simpler syntax, for example:

     

        gallery1.Items = Filter(TableA, Lookup(TableB, TableBColumn1 = TableAColumn3.Id, TableBColumn4) = N)

     

    This also assumes that the lookup field for joining the tables has an Id subfield of the same type as TableB.Column1. Please feel free to adjust the names, operators, and types as neeed for your scenario.

     

    I hope this helps.

     

  • Community Power Platform Member Profile Picture
    on at

    Can someone explain what TableBColumn1 or TableAColumn3.Id mean? I have never seen this syntax.

  • Meneghino Profile Picture
    6,949 on at

    I think there is a typo in the post, the syntax of both your excerpts seems wrong.

    Please provide your specifics if you require further help.

    Also, once you filter you may run into performance problems, and this post might help.

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 739 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 268

Last 30 days Overall leaderboard