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 / Filter Two Tables Base...
Power Apps
Answered

Filter Two Tables Based on ID

(0) ShareShare
ReportReport
Posted on by 46

Hello everyone! I'm new to PowerApps and want to first say thanks for the wealth of knowledge shared in these forums.

 

I've setup an app using several tables, as a simple example:

 

Table1: ID, Student, Grade

Table2: ID, Math, Reading


The app gallery uses data from Table1. After choosing a gallery item, I would like to populate a "Label" where the text is a "score" from Table2 based on the selected gallery item. I'm not sure where to begin with this and I haven't been able to find any solutions to similar questions that worked for this situation. 

 

Thanks in advance for the support.

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

    Hi @loepan 

    What you are describing is a classic many to many relationship. It requires three tables to model it. The third table is called a junction table. 

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @loepan ,

    How do you set up the relationship between the two Tables? Through ID column?

     

    If you want to retrieve corresponding info from another table from one table, you must make sure you have set up a relationship between the two tables through column value.

     

    I assume that the two Tables owns common ID column value, they are related through the ID column. Based on the needs that you mentioned, I think the LookUp function could achieve your needs.

    Add a Label in your app, set the Text property to following (retrieve Math score):

    LookUp(Table2, ID = Gallery1.Selected.ID, Math)

    or

    LookUp(Table2, ID = Gallery1.Selected.ID).Math

     

    If you want to retrieve the Reading score from the Table2, please try the following formula:

    LookUp(Table2, ID = Gallery1.Selected.ID, Reading)

     

    Best regards, 

  • loepan Profile Picture
    46 on at

    @v-xida-msft 

    Thanks for the response. This is really helpful. I have not setup a relationship between the two tables. Both tables are located in Excel Files in OneDrive for Business. What is the best move forward for setting up a relationship between these two tables? Should I move the data to a CDS or is there is way to do it through Excel? If a CDS, can you recommend a guide that's beginner friendly?

     

    Thanks again.

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @loepan ,

    If the ID column in your Table1 represents the Student ID, you could consider add a column in your Table2 called "studentID" to reference values from the ID column in your Table1 (you need to enter the value in studentID column manually). Then this relationship would be set up. After that, you could use above solution I provided in your scenario.

     

    In addition, you could consider create two SP Lists as your data source. Then within SP List2, you could defined a LookUp type column to reference values from the ID column in your SP List1.

     

    Best regards,

  • loepan Profile Picture
    46 on at

    Thank you! This worked perfectly. 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 430

#2
timl Profile Picture

timl 318 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard