Forum Discussion

mclawler's avatar
mclawler
Icon for Helper III rankHelper III
2 years ago
Solved

Totals Row not summing properly

Hi Everybody, I can't seem to figure out how to get the Totals row to Sum properly.  I would assume SUMX needs to be interjected in here somewhere but can't quite seem to fogure it out.  Please advis...
  • MattAllington's avatar
    2 years ago

    The simplest way to solve the "totals don't add up" problem is to replicate the structure of the rows in your visual inside the measure. 

    the reason you are getting the right answer in the row section is because each row is being calculated separately. At the total row, all of the data is aggregated and a single calculation is completed. You need to replicate the row by row calculation in the total. 

     

    write a new measure that references the current measure

    SUMX(VALUES(Table[Column in your visual]),[reference current measure that doesn't work])

     

    or rewrite the current measure 

    SUMX(VALUES(Table[Column in your visual]),CALCULATE(<all code in the current measure that doesn't work>)

     


    https://exceleratorbi.com.au/use-sum-vs-sumx/