Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Circular Dependency help

Hi all   have a circular dependency error, it was working and i am not sure of the problem. i added an extra column in the below table for "Region" but my formula's shouldnt care about that consid...
  • edhans's avatar
    edhans
    4 years ago

    They were referencing each other. That is what CALCULATE() does in a Calculated Column. It creates a hidden filter for every column in the table. So when you do the first one, it works. But when you do the second one, it create a filter for the first one, but now the first one creates a filter for the second one. 

    But you don't need CALCULATE here. Here are both column formulas, one Calc Min, and the other Calc Max.

    Calc Min = 
    VAR varCurrentDiff = Data[Capacity v Usage Difference]
    VAR varMin = MIN(Data[Capacity v Usage Difference])
    VAR Result = 
    IF(
        varCurrentDiff = varMin,
        1,
        0
    )
    RETURN
        Result
    
    Calc Max = 
    VAR varCurrentDiff = Data[Capacity v Usage Difference]
    VAR varMax = MAX(Data[Capacity v Usage Difference])
    VAR Result = 
    IF(
        varCurrentDiff = varMax,
        1,
        0
    )
    RETURN
        Result

      You can see my Calc Min/Max are the same as your desired result.