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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
RENJITH_R_S
Resolver II
Resolver II

Reverse Total Calculation on Matrix Visual

Hello Friends, I have a matrix visual with Row Header as Title Contains 2 values benefits, cost and column header as year 2023,2024 and 2025 and value is a measure with calculation value = sum(column1)-sum(column2). See the screenshot. I need to update this measure as the total Net Total should be Benefits - Cost values. example consider Net total for year 2023, benefit value is 10 and cost value is 5, then Net Total = 10-5=5

please help on this

RENJITH_R_S_0-1748936967423.png

 

1 ACCEPTED SOLUTION
RENJITH_R_S
Resolver II
Resolver II

I got answer

_Matrix_Variance$ =
if (ISINSCOPE('Table'[Title]),
[_Measure],
CALCULATE([_Measure],'Table'[Title]="Benefit")-CALCULATE([_Measure],'Table'[Title]="Cost"))

View solution in original post

3 REPLIES 3
RENJITH_R_S
Resolver II
Resolver II

I got answer

_Matrix_Variance$ =
if (ISINSCOPE('Table'[Title]),
[_Measure],
CALCULATE([_Measure],'Table'[Title]="Benefit")-CALCULATE([_Measure],'Table'[Title]="Cost"))
burakkaragoz
Community Champion
Community Champion

Hi @RENJITH_R_S ,

 

To achieve the desired Net Total calculation in your Power BI Matrix visual (where Net Total for each year is Benefit - Cost, and the grand total should also be the sum of [Benefit] - sum of [Cost]), you need to create a measure that calculates the Net Total dynamically at both row and total levels.

Please try the following DAX measure:

 

Net Total =
VAR Benefit = CALCULATE(SUM('Table'[Value]), 'Table'[Title] = "Benefit")
VAR Cost = CALCULATE(SUM('Table'[Value]), 'Table'[Title] = "Cost")
RETURN
Benefit - Cost

 

- Replace 'Table' and [Value] with your actual table and column names if they are different.

This measure will correctly show Net Total as Benefit minus Cost for each year, and the total at the bottom will be the sum of all benefits minus the sum of all costs, as you expect.

If you're using a matrix and your data structure is different, let me know more details or share a sample of your data model, and I can help adjust the formula.

Let me know if this solves your problem! If so, please accept this as the solution to help others as well.
translation and formatting supported by AI

@burakkaragoz Thanks for the input. But you are not clear on my requirement. I want to see the benefit, cost and Net total in a single measure

current measure = um(column1)-sum(column2)

so automatically Total with sum up the benefit value and cost value

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors