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
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
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!

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.

Top Solution Authors