Forum Discussion

TracyTran's avatar
TracyTran
Helper I
2 years ago
Solved

Row total does not correct with Matrix

Hi friends, 

 

I faced challenges in determining the total sales from new customers within a user-selected time period.

 

 

New_customers_Sales = 
VAR CurrentMonth = SELECTEDVALUE('D_Date'[End of Month])
var result = 
CALCULATETABLE(
    VALUES(F_Order[customerid]),
    F_Order[First Order Date (EOM)] = CurrentMonth
)
return 
SUMX(result, CALCULATE([sale_Amount]))

 

 

I encountered an issue with the Matrix visual where the row total does not display accurately.

 

 The desired output with correct row total: 

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi TracyTran ,

    The problem you are facing may be due to the context in which the totals are calculated.Power BI calculates totals based on the context of the entire table, which may not always match the expected results when using complex metric values that involve filters or specific row contexts.
    DAX overview - DAX | Microsoft Learn
    To solve this problem, you can try using the "HASONEVALUE" function to modify the behavior of the metric when calculating the total.
    HASONEVALUE function (DAX) - DAX | Microsoft Learn
    Please provide some sample data so I can try to modify DAX for you.

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

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi TracyTran ,

    The problem you are facing may be due to the context in which the totals are calculated.Power BI calculates totals based on the context of the entire table, which may not always match the expected results when using complex metric values that involve filters or specific row contexts.
    DAX overview - DAX | Microsoft Learn
    To solve this problem, you can try using the "HASONEVALUE" function to modify the behavior of the metric when calculating the total.
    HASONEVALUE function (DAX) - DAX | Microsoft Learn
    Please provide some sample data so I can try to modify DAX for you.

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