Forum Discussion

simolahansen's avatar
simolahansen
Frequent Visitor
8 years ago
Solved

subtotal does not sum, but

Hi   I have a problem When using matrix and using subtotals I have a similiar matrix as this:                 | Price pr. m2 |  Buying price |  Selling price   |  Profit     |  Units Sold |    ...
  • Anonymous's avatar
    Anonymous
    8 years ago

    HI simolahansen,

     

    Nope, current power bi has different calculation logic than what you want, you had to write a formula to control the calculation on total level.


    You goal: calculate formula on row contents first, summary above result on total level.
    What Power bi do: summary each row first and use formula calculate on summarized result.

     

    Maybe you can try to use below measures if it works:

     

    Total=
    SUM ( Table[Profit] ) * SUM ( Table[Units Sold] )


    Earned= IF ( COUNTROWS ( VALUES ( Table[RoomName] ) ) = 1, [Total], SUMX ( VALUES ( Table[RoomName] ), [Total] ) )

     

    Reference link:

    Subtotals and Grand Totals That Add Up “Correctly”

     

    Regards,

    Xiaoxin Sheng