Forum Discussion

tommk55's avatar
tommk55
Regular Visitor
6 years ago
Solved

Subtracting Row

Sorry for the rookie question but what's the easiest way to show/calculate the difference between two rows of data   e.g.  A 2020 10000 A 2021 15000 B 2020 30000 B 2021 40000 C 2020 50000 C 2...
  • lbendlin's avatar
    6 years ago

    Nothing of what you ask for is simple.  It is relatively easy to create a measure.

     

     

     

    Y := calculate(sum('Values'[Value]),'Values'[Category]="B")-
    calculate(sum('Values'[Value]),'Values'[Category]="C")

     

     

     

    But that would then go into the values well, and make your visual look off

     

     

     

    To achieve the look you are going for you would actually have to create individual measures for A, B and C, and put them under rows. (and have nothing in the actual row headers)

     

     

     

    A := calculate(sum('Values'[Value]),'Values'[Category]="A")
    B := calculate(sum('Values'[Value]),'Values'[Category]="B")
    C := calculate(sum('Values'[Value]),'Values'[Category]="C")
    Y := [B]-[C]