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
harshagraj
Post Partisan
Post Partisan

To calculate Variance % from row level

Hi all, I have a screen shot below. I have a year field and Budget,Actual and Variance(Budget-Actual) and i have to calculate Variance % i,e Variance/Budget. Now i am getting wrong values as its calculating at row level and aggregating. Instead i need Subtotal(Vaiance)/Subtotal(Budget). Kindly help me to acheieve this.

DateBudget_$_vwActual_$_vwVariance_1$Variance 1%
2012309246.0928315558.4-6312.3072-0.020411922
2012300198.5664274657.508725541.057660.085080545
201294325.76112304.5005-17978.74048-0.190602657
201268124.1683723.6585-15599.4985-0.228986288
20121765045.7221762290.9422754.7792640.001560741
2012425794.2272429713.8499-3919.622656-0.009205439
20126971.90410574.0544-3602.1504-0.516666667
201211756.5444380.2247376.320.627422481
 2981462.9762993203.138-11740.1623-0.003937719
     
     
 Variance1% =Subtotal(Variance_1$)/Subtotal(Budget_$-vw)
 
1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @harshagraj ,

 

Check the following measure about calculating Variance% per year.

 

Measure = CALCULATE(SUM('Table'[Variance_1$]),ALLEXCEPT('Table','Table'[Date]))/CALCULATE(SUM('Table'[Budget_$_vw]),ALLEXCEPT('Table','Table'[Date]))

 

 If you want calculate Variance% for all years, just use ALL() function instead of ALLEXCEPT() function.
Result would be shown as below.

2.PNG

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

4 REPLIES 4
v-jayw-msft
Community Support
Community Support

Hi @harshagraj ,

 

Check the following measure about calculating Variance% per year.

 

Measure = CALCULATE(SUM('Table'[Variance_1$]),ALLEXCEPT('Table','Table'[Date]))/CALCULATE(SUM('Table'[Budget_$_vw]),ALLEXCEPT('Table','Table'[Date]))

 

 If you want calculate Variance% for all years, just use ALL() function instead of ALLEXCEPT() function.
Result would be shown as below.

2.PNG

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

Hi @v-jayw-msft thank you so much for your help a big kudos to you. It worked perfectly.

amitchandak
Super User
Super User

@harshagraj 

Hope you are using sum(A)/Sum(B) not Sum(A/B)

Like

divide((sum(Actual_$_vw)-sum(Table[Budget_$_vw])),sum(Table[Budget_$_vw]))

Hi @amitchandak thank you but i am getting wrong values by that..I am getting -0.25 instead of -0.003.

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.