Forum Discussion

Mattm1989's avatar
Mattm1989
Regular Visitor
1 year ago
Solved

Issue with variance calculations

Hi   Please could someone help me understand what I am doing wrong?   I am using variables to calculate the sum of the same column but using different selections based on a different column via s...
  • SamWiseOwl's avatar
    1 year ago

    Hi Mattm1989 

    Unfortunately the slicers count as an AND filter on the card.

    Meaning it tries to filter your Master table to only rows that fufill BOTH criteria.

     

    You can either:

    Use one slicer and have the two measures return only one of the items in the list. If the user can only ever choose one using Min on one and max on the other would work. 

    Var01 =
    VAR Actual_Bud_01 = Max(Master[Actual / Budget1])
    VAR Total_Act_Bud_01 = CALCULATE(SUM(Master[Amt USD - PTD1]), Master[Actual / Budget1] = Actual_Bud_01)
    RETURN Total_Act_Bud_01
     
    Or you have a second copy of the Master[Actual/budget] column in a seperate and completely unlinked table for the second calculation.

     

    Var01 =
    VAR Actual_Bud_01 = SelectedValue(MasterCopy[Actual / Budget1])
    VAR Total_Act_Bud_01 = CALCULATE(SUM(Master[Amt USD - PTD1]), Master[Actual / Budget1] = Actual_Bud_01)
    RETURN Total_Act_Bud_01
     
     
    Let me know if you get stuck 🙂