Forum Discussion

Alexbienvenue's avatar
Alexbienvenue
Frequent Visitor
4 years ago
Solved

How do I get this subtotal to display correctly

As you can see, the total displayed is incorreect based on the dax measure Ive written for it. 

 

Just to note about my sitatuion here - I needed to use ALLEXCEPT because i need the TEST column to display those numbers independent of SKU column context...If i remove the ALLEXCEPT part it will take away some of the "juice" components of each SKU because not each SKU has a "Press" action as defined by my Wine Proccesing [Action] = "Press" column...any ideas? 

2 Replies

  • Hi Alexbienvenue ,

     

    You issue is a question of context on the totals the calculation is based on the overall table so you your calculation based on all the line that corresponde to that value.

     

    Try the following code:

     

    test =
    var PressGallonsTEST = ....
    
    Return
    SUMX(ALLSELECTED('Wine Processing'[SKU]), PressGallonsTEST)

     

    Be aware that this may need some adjustments.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Alexbienvenue ,

    You can create another new measure as below and put this new measure to replace the original measure [test]...

    Measure =
    SUMX (
        GROUPBY ( 'Wine Processing', 'Wine Processing'[SKU], 'Wine Processing'[Juice] ),
        [test]
    )

    In addition, you can refer the following links to try to solve your problem...

    Why Your Total Is Incorrect In Power BI - The Key DAX Concept To Understand

    Dax for Power BI: Fixing Incorrect Measure Totals

    Best Regards