cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

powerapps Joining tables with multiple records

Hi, I am trying to join 2 tables in powerapps and trying to get the true inner join data. below is my sample data -

 

suppose user placed an order with multiple products, I want to join 1 record from Order with Multiple records from product table.

 

Table Orders -

 

OrderID, OrderDate

1, 2018-01-21

2, 2017-01-31

 

Table products -

ProductName, orderID

ABC, 1

CDE, 1

SDW,1

LOJ,2

 

Final Result -

 

Order ID, OrderDate, ProductName

1,2018-01-21,ABC

1,2018-01-21,CDE

1,2018-01-21,SDW

2, 2017-01-31, LOJ

 

I tried Addcolumns using lookup but it only brings one value, is it possible in powerapps or do I need to go to View route?

 

Thanks in Advance

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Hi @Anchal_D ,

Do you want to join the Orders Table and Products Table based on Order ID value?

Could you please share a bit more about the AddColumns formula you used in your app?

 

I have made a test on my side, please consider take a try with the following workaround:

Add a Data Table control within your app, set the Items property to following:

AddColumns(
              ProductsTable,           /* <-- Type ProductsTable here rather than Orders Table */
              "OrderDate",
              LookUp(OrdersTable, OrderID = ProductsTable[@orderID], OrderDate)
)

then enable corresponding columns within the Data Table control.

 

More details about the Disambiguation operator (@) in PowerApps, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/operators#disambiguation-oper...

 

Best regards,

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

View solution in original post

3 REPLIES 3
Highlighted
Dual Super User II
Dual Super User II

Hi @Anchal_D 

 

AddColumns(ProductsTable,"OrderDate",LookUp(OrdersTable,OrderID=orderID).OrderDate)

 

where ProductsTable = name of products table

OrdersTable = name of orders table

OrderID = column in orders table

orderID = column in products table

OrderDate = column in orders table

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Highlighted
Super User III
Super User III

From what I can tell the relationship between your tables is one order with many different products. If this is the case could do a left table join instead of an inner join (products -> orders).

ClearCollect(myJoinedData,
AddColumns(Products,"OrderDate",LookUp(Orders,OrderId=Products[@OrderId],OrderDate)))

 

The resulting table will look like this...

 

img3.png



Please Accept as Solution if this post answered your question so others can find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

Highlighted
Community Support
Community Support

Hi @Anchal_D ,

Do you want to join the Orders Table and Products Table based on Order ID value?

Could you please share a bit more about the AddColumns formula you used in your app?

 

I have made a test on my side, please consider take a try with the following workaround:

Add a Data Table control within your app, set the Items property to following:

AddColumns(
              ProductsTable,           /* <-- Type ProductsTable here rather than Orders Table */
              "OrderDate",
              LookUp(OrdersTable, OrderID = ProductsTable[@orderID], OrderDate)
)

then enable corresponding columns within the Data Table control.

 

More details about the Disambiguation operator (@) in PowerApps, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/operators#disambiguation-oper...

 

Best regards,

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

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (9,713)