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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
BarryWhitelaw
Regular Visitor

Simple Matrix with Variance

HI there

 

I am a very new user to Power Bi, and struggling with something I thought must be a simple visualization.

 

For my data I need to show a matrix, years in the columns and months in the rows, with the spend per month/year shown.  This I can do easily.

 

BarryWhitelaw_0-1756039343767.png

 

My data is very basic.

 

BarryWhitelaw_1-1756039343973.png

 

 

 

However, I also need to show the variance from last year to this year, and this is where I get stuck!  Using co-pilot it supplied a dax formula, however that also shows the variance for last year (against nothing so shows as a minus) and it seems this can't be hidden/excluded.  

 

The end result i need is:

 

   

          2024        2025        Variance

Jan     24.50       39.21          14.71

Feb    13.95       24.56          10.61

Mar    32.10      29.55           -2.55

etc

 

Is this doable?  I am trying to show my company, and those that make the decisions, the Power Bi is a worthwhile expense, but struggling with this very basic starting point.

 

The data can be run in any way needed.  I'm quite proficient with Power Query so that side isn't an issue.

 

many thanks

2 ACCEPTED SOLUTIONS
pankajnamekar25
Super User
Super User

Hello @BarryWhitelaw 

 

Try these measure

1.Total Spend = SUM('Table'[Spend])


2.Previous Year Spend =
CALCULATE(
[Total Spend],
SAMEPERIODLASTYEAR('Table'[Date])
)

 

3.Variance =
[Total Spend] - [Previous Year Spend]


4.Variance =
VAR Curr = [Total Spend]
VAR Prev = [Previous Year Spend]
RETURN
IF(
NOT ISBLANK(Curr) && NOT ISBLANK(Prev),
Curr - Prev
)

 


If my response helped you, please consider clicking
Accept as Solution and giving it a Like 👍 – it helps others in the community too.


Thanks,


Connect with me on:

LinkedIn

 

View solution in original post

danextian
Super User
Super User

Hi @BarryWhitelaw 

Please try the approaches in the attached pbix.

 

Selected years:

danextian_0-1756117975753.png

Max and previous years:

danextian_1-1756118009992.png

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

3 REPLIES 3
BarryWhitelaw
Regular Visitor

Thank you both for your replies.  This is a prime example of trying to run before I can walk!

 

After watching some YouTube videos it dawned on me that I should be creating a measure for each period, which would then allow me to use those measures in a calculation! Once I realsied that, it was of course a simple task!

 

Note to brain, training!

danextian
Super User
Super User

Hi @BarryWhitelaw 

Please try the approaches in the attached pbix.

 

Selected years:

danextian_0-1756117975753.png

Max and previous years:

danextian_1-1756118009992.png

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
pankajnamekar25
Super User
Super User

Hello @BarryWhitelaw 

 

Try these measure

1.Total Spend = SUM('Table'[Spend])


2.Previous Year Spend =
CALCULATE(
[Total Spend],
SAMEPERIODLASTYEAR('Table'[Date])
)

 

3.Variance =
[Total Spend] - [Previous Year Spend]


4.Variance =
VAR Curr = [Total Spend]
VAR Prev = [Previous Year Spend]
RETURN
IF(
NOT ISBLANK(Curr) && NOT ISBLANK(Prev),
Curr - Prev
)

 


If my response helped you, please consider clicking
Accept as Solution and giving it a Like 👍 – it helps others in the community too.


Thanks,


Connect with me on:

LinkedIn

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.