Forum Discussion

harshagraj's avatar
harshagraj
Post Partisan
6 years ago
Solved

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)
 
  • Anonymous's avatar
    Anonymous
    6 years ago

    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.

     

    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.

4 Replies

  • 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]))

    • harshagraj's avatar
      harshagraj
      Post Partisan

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    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.

     

    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.

    • harshagraj's avatar
      harshagraj
      Post Partisan

      Hi Anonymous thank you so much for your help a big kudos to you. It worked perfectly.