Forum Discussion

JoshP11's avatar
JoshP11
Helper II
1 year ago
Solved

Conditional formatting measure not working

Hello,   I'm using the below measure for some conditional formatting, and on one hand it's working as expected, however I can't get it to work for blank values, the colour seems to replicate what e...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi ,

    The TestValues variable should get the Dynamic_Recent value. Try using the following dax formula.

    ValueColor =
    VAR TestAve = [AverageValue]
    VAR TestStdDev = [StdDevValue]
    VAR TestValue = SELECTEDVALUE('Unpivot Data'[Value], BLANK())
    RETURN
    SWITCH(
        TRUE(),
        ISBLANK(TestValue), "#FFFFFF",  -- White color for blank values
        TestValue >= TestAve + TestStdDev, "#53E17E",
        TestValue >= TestAve + 0.5 * TestStdDev && TestValue < TestAve + TestStdDev, "#FFFF47",
        TestValue >= TestAve - TestStdDev && TestValue < TestAve + 0.5 * TestStdDev, "#FFB700",
        TestValue <= TestAve - TestStdDev, "#FF1414",
        "#FFFFFF"  -- Default to white if none of the conditions are met
    )

     

     

    Best Regards,

    Wisdom Wu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.