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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
tbobolz
Resolver I
Resolver I

Can anyone offer help with a variance calculation between row s of a filtered matrix

Hi, thanks for looking. I have read through a few other post, yet I am still puzzled. Since my matrix is filtered to two dimensions, it is a little to complex for my skill level. 

 

Here is the smaple pbix link:

Sample pbix 

 

Ultimately, I'd like to look like this smaple:

Sample final 

 

Thanks again for looking.

Terry

 

2 ACCEPTED SOLUTIONS
shawne
Resolver I
Resolver I

Solution 

 

Create Measures for each variation of Dollars like this: 

 

Actual =
CALCULATE (
SUM ( 'Oncology DB Budget Gross Revenue - Extract'[Dollars] ),
'Oncology DB Budget Gross Revenue - Extract'[Time Class - TimeClass] = "Actual")
-------------------------------------------------------------------------------------------------- 
Budget =
CALCULATE (
SUM ( 'Oncology DB Budget Gross Revenue - Extract'[Dollars] ),
'Oncology DB Budget Gross Revenue - Extract'[Time Class - TimeClass] = "Budgeted")
 -------------------------------------------------------------------------------------------------- 
Variance =
VAR Actual =
CALCULATE (
SUM ( 'Oncology DB Budget Gross Revenue - Extract'[Dollars] ),
'Oncology DB Budget Gross Revenue - Extract'[Time Class - TimeClass] = "Actual"
)
VAR Budge =
CALCULATE (
SUM ( 'Oncology DB Budget Gross Revenue - Extract'[Dollars] ),
'Oncology DB Budget Gross Revenue - Extract'[Time Class - TimeClass] = "Budgeted"
)
VAR Result = Actual - Budge
RETURN
Result
 -------------------------------------------------------------------------------------------------- 
Variance % = DIVIDE([Variance],[Budget])
-------------------------------------------------------------------------------------------------- 
Then remove time class from the Rows and add all measures into values.  Remove the "Dollars" field from values.  Go to the formatting of the visual, go to values section and set "Show Values On Rows".  Should Work as requested. 
 
 

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you as well Ashish for taking the time to help me. As I mentioned to Shawne, this makes perfect sense now that i see it.

 

Terry

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@tbobolz , You need have all you four-measure Actual, Budget, Variance and Variance % and Show them in matrix with option - "Show on Row"

 

Show on Row.png

shawne
Resolver I
Resolver I

Solution 

 

Create Measures for each variation of Dollars like this: 

 

Actual =
CALCULATE (
SUM ( 'Oncology DB Budget Gross Revenue - Extract'[Dollars] ),
'Oncology DB Budget Gross Revenue - Extract'[Time Class - TimeClass] = "Actual")
-------------------------------------------------------------------------------------------------- 
Budget =
CALCULATE (
SUM ( 'Oncology DB Budget Gross Revenue - Extract'[Dollars] ),
'Oncology DB Budget Gross Revenue - Extract'[Time Class - TimeClass] = "Budgeted")
 -------------------------------------------------------------------------------------------------- 
Variance =
VAR Actual =
CALCULATE (
SUM ( 'Oncology DB Budget Gross Revenue - Extract'[Dollars] ),
'Oncology DB Budget Gross Revenue - Extract'[Time Class - TimeClass] = "Actual"
)
VAR Budge =
CALCULATE (
SUM ( 'Oncology DB Budget Gross Revenue - Extract'[Dollars] ),
'Oncology DB Budget Gross Revenue - Extract'[Time Class - TimeClass] = "Budgeted"
)
VAR Result = Actual - Budge
RETURN
Result
 -------------------------------------------------------------------------------------------------- 
Variance % = DIVIDE([Variance],[Budget])
-------------------------------------------------------------------------------------------------- 
Then remove time class from the Rows and add all measures into values.  Remove the "Dollars" field from values.  Go to the formatting of the visual, go to values section and set "Show Values On Rows".  Should Work as requested. 
 
 

Thank you Shawne,

 

This looked so painful obvious once i seen it. 🙄 I apprecaite you taking the time to assist!

No problem at all!  Glad to help.  In this table structure it is easier to calculate than when Budget and Actuals are in seperate tables.  But if you ever encounter that, here is a great reference.  Again, way more tricky when delaing with multiple finance tables, but this article is very helpful if you run into it as you get deeper and deeper into DAX.     https://www.daxpatterns.com/budget/ 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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