Forum Discussion

alycianw's avatar
alycianw
Frequent Visitor
2 years ago
Solved

Variance between values in same column based on specific category

I think I need a DAX command but I am new and not sure the best way to accomplish my need. I have 2 columns "Values" and "Version". I need to calcuate the variance between the Acutals and the Budg...
  • govindarajan_d's avatar
    2 years ago

    Hi alycianw,

     

    I see that Actuals and Budget are two different sets of rows in the table. I would suggest pivoting the table, but I see there is something called as Forecast as well. If you think you can have actuals, budget and forecast for every unique row by pivoting you can do that. 

     

    If you don't want to pivot, you can try this DAX measure:

    Variance = 
    VAR __Actual = CALCULATE(Table[Value],Table[Version]="Actuals")
    VAR __Budget = CALCULATE(Table[Value],Table[Version]="Budget")
    VAR __Variance = __Actual - __Budget
    RETURN __Variance
  • govindarajan_d's avatar
    govindarajan_d
    2 years ago

    Hi alycianw,

     

    Did the solution work?

     

    If so, please accept as a solution!

  • JamesFR06's avatar
    2 years ago

    HI,

     

    Try this

     

    Measure Variance=

    VAR __Actual = CALCULATE(Table[Value],Table[Version]="Actuals",allexcept(Table[Vendor])
    VAR __Budget = CALCULATE(Table[Value],Table[Version]="Budget",allexcept(Table[Vendor])
    VAR __Variance = __Actual - __Budget
    RETURN __Variance