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
Naveen123
Frequent Visitor

How to show difference between two values in Matrix view

Hi All,

 

I have used Matrix view to display profit and sales based on Fiscal year. I am not sure how to display the difference between 2023, 2022 sales and profit for each row. 

 

Thanks in advance!
Snip.PNG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Naveen123 ,

 

If your table looks like as below, I suggest you to try to show difference in Column Subtotal part.

vrzhoumsft_0-1689672376163.png

M_Sales = 
VAR _THISYEAR = CALCULATE(SUM('Table'[Sales]),'Table'[Year] = 2023)
VAR _LASTYEAR = CALCULATE(SUM('Table'[Sales]),'Table'[Year] = 2022)
RETURN

IF(HASONEVALUE('Table'[Year]),CALCULATE(SUM('Table'[Sales])),_THISYEAR - _LASTYEAR)
M_Profit = 
VAR _THISYEAR = CALCULATE(SUM('Table'[Profit]),'Table'[Year] = 2023)
VAR _LASTYEAR = CALCULATE(SUM('Table'[Profit]),'Table'[Year] = 2022)
RETURN

IF(HASONEVALUE('Table'[Year]),CALCULATE(SUM('Table'[Profit])),_THISYEAR - _LASTYEAR)

Result is as below.

vrzhoumsft_1-1689672406313.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Naveen123 ,

 

If your table looks like as below, I suggest you to try to show difference in Column Subtotal part.

vrzhoumsft_0-1689672376163.png

M_Sales = 
VAR _THISYEAR = CALCULATE(SUM('Table'[Sales]),'Table'[Year] = 2023)
VAR _LASTYEAR = CALCULATE(SUM('Table'[Sales]),'Table'[Year] = 2022)
RETURN

IF(HASONEVALUE('Table'[Year]),CALCULATE(SUM('Table'[Sales])),_THISYEAR - _LASTYEAR)
M_Profit = 
VAR _THISYEAR = CALCULATE(SUM('Table'[Profit]),'Table'[Year] = 2023)
VAR _LASTYEAR = CALCULATE(SUM('Table'[Profit]),'Table'[Year] = 2022)
RETURN

IF(HASONEVALUE('Table'[Year]),CALCULATE(SUM('Table'[Profit])),_THISYEAR - _LASTYEAR)

Result is as below.

vrzhoumsft_1-1689672406313.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

@Naveen123 , You can use diff measure

example

//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 ])

 

 

or you can follow this approch

Power BI Time Intelligence- Show month names instead of Current Month Vs Last Month- https://youtu.be/x0DvPn1QeO4

 

 

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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