sheetal
sheetal

Reputation: 53

Showing unexpected values in Power BI charts

Please find my expected result below

chart expected

But I am getting result as below

chart obtained

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

Power BI datamodel

I have given a relationship as shown below

Power BI datamodel Relationship

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

Power BI Realtionship details

Orders table:

Orders

Order Items table:

enter image description here

Upvotes: 2

Views: 106

Answers (1)

Andrew Dyachkov
Andrew Dyachkov

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. Final table

Upvotes: 0

Related Questions