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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
dzuurman
Helper I
Helper I

% difference between columns in matrix table

I have a matrix table, in which users can specify which years they want to compare the months of. Say in this case 2019 vs 2020

Of course having the totals of those months show up is easy enough. But I want to add a column in between the years showing the % difference between the two values. 

 

I have searched online a great deal but the answers weren't forthcoming or I may have misunderstood them.  Any help will be greatly appreciated.

 

dzuurman_0-1623918597771.png

 

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @dzuurman ,

 

Suppose your table is like below:

vkellymsft_0-1624416959511.png

Create a measure as below:

Measure = IF(ISINSCOPE('Table'[Year]),SUM('Table'[Amount]),
var _2019=CALCULATE(SUM('Table'[Amount]),FILTER('Table','Table'[Year]=2019))
var _2020=CALCULATE(SUM('Table'[Amount]),FILTER('Table','Table'[Year]=2020))
Return
_2020-_2019)

And you will see:

vkellymsft_1-1624416997459.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

View solution in original post

2 REPLIES 2
v-kelly-msft
Community Support
Community Support

Hi @dzuurman ,

 

Suppose your table is like below:

vkellymsft_0-1624416959511.png

Create a measure as below:

Measure = IF(ISINSCOPE('Table'[Year]),SUM('Table'[Amount]),
var _2019=CALCULATE(SUM('Table'[Amount]),FILTER('Table','Table'[Year]=2019))
var _2020=CALCULATE(SUM('Table'[Amount]),FILTER('Table','Table'[Year]=2020))
Return
_2020-_2019)

And you will see:

vkellymsft_1-1624416997459.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

amitchandak
Super User
Super User

@dzuurman  In case you want grand total to diff of last two years.

 

You need to have mesure like

 

diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])

 

Then use

if(not(isinscope('Date'[Year])) && isinscope('Date'[Month]) ,[Diff %] , [This Year])

 

 

This year =SUM(Sales[Sales Amount])

Last Year = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
Last Year= CALCULATE(SUM(Sales[Sales Amount]),SAMEPERIODLASTYEAR('Date'[Date]))

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.