Reputation: 53
Please find my expected result below
But I am getting result as below
where I have choosed Order Id from orders table and Product Id from Order Items tables and I have used below measure order_to_orderitem = CALCULATE(SUM('Order Items'[Unit Price]),USERELATIONSHIP(orders[key12],'Order Items'[key12]))
Note: key12 is merged column of Order Id and Product Id in both orders and Order Items table
I have a datamodel as shown below
I have given a relationship as shown below
It has been created as shown below where From Table is Order Items and To Table is orders whereas while creating I have given orders as From Table and Order Items as To Table
Orders table:
Order Items table:
Upvotes: 2
Views: 106
Reputation: 316
If you want to return all rows from the orders table and the matching rows from the Order Items table you can just create a new table with LEFT JOIN.
NewTable = NATURALLEFTOUTERJOIN ('orders', 'Order Items' )
(the function works for the tables that don't have the same column names). To get this table check "Show items with no data" for the first column.
Upvotes: 0