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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
dopingcontrol
New Member

power bi difference between two columns in a matrix

Hello community,

I would like to calculate a difference absolute and percent between two columns in my visualisation.

 

My data looks like this:

 

 

LEVELDATEREVENUE
ActualJanuary 100
BudgetJanuary 110
Actual February 90
BudgetFebruary 95
ActualMarch115
BudgetMarch105
ActualApril130
BudgetApril120
   

 

I want to have the following matrix with the difference column Actual vs Budget.

 

DATEACTUALBUDGETDiff 
January100110-10 
February9095-5 
March115105+10 
April130120+10 
     
     
     
     

 

 

 

Is this possible?

I would be very grateful for your help.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @dopingcontrol ,

 

Arul use PIVOT function in Power Query to achieve your goal. This way will transform your data model. If you don't want to transform your table, you can try to create a measure to show difference in Total and rename "Total" by "Diff".

 

Measure = 
VAR _REVENUE = SUM('Table'[REVENUE])
VAR _ACTUAL = CALCULATE( SUM('Table'[REVENUE]),'Table'[LEVEL] = "Actual")
VAR _Budget = CALCULATE( SUM('Table'[REVENUE]),'Table'[LEVEL] = "Budget")
RETURN
IF(HASONEVALUE('Table'[LEVEL]),_REVENUE,_ACTUAL - _Budget)

 

Then create a matrix visual.

RicoZhou_1-1652428394179.png

Result is as below.

RicoZhou_0-1652428383246.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 @dopingcontrol ,

 

Arul use PIVOT function in Power Query to achieve your goal. This way will transform your data model. If you don't want to transform your table, you can try to create a measure to show difference in Total and rename "Total" by "Diff".

 

Measure = 
VAR _REVENUE = SUM('Table'[REVENUE])
VAR _ACTUAL = CALCULATE( SUM('Table'[REVENUE]),'Table'[LEVEL] = "Actual")
VAR _Budget = CALCULATE( SUM('Table'[REVENUE]),'Table'[LEVEL] = "Budget")
RETURN
IF(HASONEVALUE('Table'[LEVEL]),_REVENUE,_ACTUAL - _Budget)

 

Then create a matrix visual.

RicoZhou_1-1652428394179.png

Result is as below.

RicoZhou_0-1652428383246.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.

 

Arul
Super User
Super User

@dopingcontrol ,

Yes it is possible!!

You need to pivot your table in power query editor based on date column,

Arul_0-1652251398887.png

Then,

write the below measure and use actual,budget and measure in the matrix visual.

Arul_1-1652251455193.png

 

Thanks,

Arul

 





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

Proud to be a Super User!


LinkedIn


Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.