Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
tommk55
Regular Visitor

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 2021 60000

etc

 

Just simply showing in a Matrix by Letter and Year

 

     2020 2021

A    

B

C

...

Y

Z

Then I want to add an addtional set 'Y' which is just (B-C) for each year, and then in Z have some conditional logic based on whether Y is Positive/Negative.

 

Thanks in advance

 

 

 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

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

 

 

lbendlin_0-1599011770801.png

 

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]

 

 

 

lbendlin_0-1599012146453.png

 

lbendlin_1-1599012028534.png

 

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

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

 

 

lbendlin_0-1599011770801.png

 

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]

 

 

 

lbendlin_0-1599012146453.png

 

lbendlin_1-1599012028534.png

 

thanks, that's really useful ...brings the usage of measures to life a bit for me.

 

much appreciated!!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors