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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

How to have variance instead of total for column subtotal in Matrix

Hi Team,

I am new to power BI. I am using matrix visualization to show the average of data for departments for the two years. Below is the screenshot of sample data.

ShrutiDande_0-1677222609722.png

My requirement is that, instead of column subtotal i want to have variance of the data. i.e data of 2021 subtracted from data of 2022(e.g for division A: 56.57 - 20) and show the difference instead of total. The data displayed in matrix  is the average of the
data divisionwise for that particular year.

Thanks!

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Make sure you are having a separate year/date table and create a diff measure

 

//Only year vs Year, not a level below

This Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])

 

You can use allselected in this case

This Year = CALCULATE(sum('Table'[Qty]),filter(allselected('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('Table'[Qty]),filter(allselected('Date'),'Date'[Year]=max('Date'[Year])-1))

 

 

Then you need a meausre like

if(not(isinscope('Date'[Year])), sum('Table'[Qty]),[diff ])

 

Make sure you use year in visual from date/year table

 

IsInScope - Switch measure at different levels: https://youtu.be/kh0gezKICEM

 

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
rajulshah
Resident Rockstar
Resident Rockstar

@Anonymous ,

 

Can you please share your structure or sample data?

Anonymous
Not applicable

Hi @rajulshah 
here is screenshot of my sample data.

ShrutiDande_0-1677246467066.png

Thanks!

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.