Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Referencing data from one table from a selection in another

I have two SQL tables - '[dbo].[Person]' and '[dbo].[Department]'

In '[dbo].[Person]' there is a DepartmentID.  I want to reference the DepartmentID in '[dbo].[Department]' and return departmentName based on the selected item in '[dbo].[Person]'


I tried: 
LookUp('[dbo].[Department]', DepartmentID = '[dbo].[Person]'.Selected.DepartmentID, DepartmentName)
LookUp('[dbo].[Department]', DepartmentID = ThisItem.DepartmentID, DepartmentName)

LookUp('[dbo].[Department]', DepartmentID = DepartmentID, DepartmentName)


The third option is the only one that returns anything - and it returns the first DepartmentName in '[dbo].[Department]' for all records



Accepted Solutions

The way around this problem is to create a VIEW in SQL.  


Watch this video

View solution in original post

Community Support
Community Support

Hi @ChipMichael,


Are you using this formula in the Items property of the Gallery control? If so, please unserstand that one Gallery could only have one data source. To use the DepartmentID from '[dbo].[Person]', you need to first insert a dropdown control, set its Items property to:

Distinct( '[dbo].[Person]',DepartmentID)

Then set the Items property of the Gallery to:

Filter('[dbo].[Department]', DepartmentID = Dropdown1.Selected.Value)

To return the DepartmentName, with the Gallery control selected, click on the table name is the right side, then pick with field you want to show in the Gallery:





Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Would it be possible to put table A in a list - reference the "selection" from that list based on a selection from table B? 



Table A 

PersonID   Name   DepartmentID      TitleID
     1             Jack         2                          3
     2             Jill            1                          2


Table B 

DepartmentID    DepartmentName

       1                     Marketing

       2                     Manufacturing


Table C 

TitleID          Title

  1               President
  2               Vice President
  3               Director

If I want information from PersonID 1 from Table A how do I display ?

Jack, Manufacturing, Director   

The way around this problem is to create a VIEW in SQL.  


Watch this video

View solution in original post

Helpful resources

PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!


Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (59,093)