Forum Discussion

analyticspbi87's avatar
1 year ago
Solved

Circular Dependency when using variable in measures

Hi there,   Currently, I'm trying to get two different measures to show as follows and am getting an error on the second variable. Building Year Value Type Cost Type Value Thousands Group...
  • lbendlin's avatar
    1 year ago

    You have a couple of typos in your formulas, but there is no circular dependency anywhere.

     

     

    % of TOTAL A = 
    VAR ANUMERATOR =
        DIVIDE (
            CALCULATE (
                SUM ( 'Data'[Value] ),
                'Data'[Group] <> "A",
                'Data'[Type Cost] = "Add Year"
            ),
            1000
        )
    VAR ADENOMINATOR =
        DIVIDE ( SUM ( 'Data'[Multiplier] ) * SUM ( Data[ TOTAL A ] ), 1000 )
    RETURN
        DIVIDE ( ANUMERATOR, ADENOMINATOR )
    
    % of TOTAL B =
    VAR BNUMERATOR =
        DIVIDE (
            CALCULATE (
                SUM ( 'Data'[Value] ),
                'Data'[Group] <> "A",
                'Data'[Type Cost] = "Add Year",
                'Data'[Type] = "Non-Recoverable"
            ),
            1000
        )
    VAR BDENOMINATOR =
        DIVIDE ( ( SUM ( 'Data'[Multiplier] ) * SUM ( 'Data'[ TOTAL B ] ) ), 1000 )
    RETURN
        DIVIDE ( BNUMERATOR, BDENOMINATOR )