Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
sheetals
Helper I
Helper I

Showing unexpected values in Power BI charts

Please find my expected result below

pbi3.PNG

But I am getting result as below

pbi4.PNG

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

pbi5.png

I have given a relationship as shown blow

pbi6.PNG

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

pbi7.PNG

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @sheetals 

 

You can try the following methods.

order_to_orderitem = 
IF (
    MAX ( 'orders'[Product ID] ) == BLANK (),
    BLANK (),
    CALCULATE (
        SUM ( 'Order Items'[Unit Price] ),
        USERELATIONSHIP ( orders[key12], 'Order Items'[key12] )
    )
)

vzhangti_0-1638760552167.png

If the method I provided above can't solve your problem, what's your expected result? Could you please provide more details for it?

 

Best Regards,

Community Support Team _Charlotte

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

1 REPLY 1
v-zhangti
Community Support
Community Support

Hi, @sheetals 

 

You can try the following methods.

order_to_orderitem = 
IF (
    MAX ( 'orders'[Product ID] ) == BLANK (),
    BLANK (),
    CALCULATE (
        SUM ( 'Order Items'[Unit Price] ),
        USERELATIONSHIP ( orders[key12], 'Order Items'[key12] )
    )
)

vzhangti_0-1638760552167.png

If the method I provided above can't solve your problem, what's your expected result? Could you please provide more details for it?

 

Best Regards,

Community Support Team _Charlotte

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.