Forum Discussion
Combining tables IF
- 7 years ago
PowerBIUser9901 try this
Table_Combine = UNION ( DISTINCT( Table_1 ), DISTINCT( CALCULATETABLE( Table_2, EXCEPT( VALUES( Table_2[Order_Id] ), VALUES( Table_1[Order_Id] ) ) ) ) )
PowerBIUser9901 try union and distinct function
Go to modelling tab, data table and add following DAX.
New Table =
DISTINCT(
UNION
( TABLE1, TABLE2 )
)- PowerBIUser99017 years agoAdvocate II
Hi parry2k ,
You DAX formula doesn’t address the logic of If Order_ID is included in Table_1 and Table_2 then only include the Table_1 row data.
Notice in the picture below by using your DAX formula if an Order_ID is in both Table_1 and Table_2 then it shows all row data associated to that Order_ID from both tables rather than just Table_1.
- parry2k7 years agoSuper User
PowerBIUser9901 what happens if one order has multiple product and company code for same order in table1, which row would you like to get in that case? What is the bussines logic to which order row to keep?
- PowerBIUser99017 years agoAdvocate II
If Table_1 Order_ID has multiple Product codes and Company codes associated to them then the end result should be a table of the same Order_ID repeating for each association such as the Desired Output table I showed above.