Forum Discussion

Snagalapur's avatar
Snagalapur
Icon for Helper IV rankHelper IV
1 year ago
Solved

Conditional formatting cards and Table values

Hi All, Please suggest how to handle blank /NAN/ Infinity values in conditional formatting?   Current formula: % Bud Color =IF('table'[% Bud] < 1, "#FF0000", "#00CC66")   Thank you.
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi, Snagalapur 

    Based on your description, I've created the following example data to simulate your situation:

    I use divide as a division function instead of /. This enables safe division.

     

    % Bud Clean = 
    VAR Denominator = SUM(BudgetPerformance[Denominator])
    VAR Numerator = SUM(BudgetPerformance[Numerator])
    VAR Ratio = DIVIDE(Numerator, Denominator) // Handles divide-by-zero as blank
    RETURN
        IF(
            ISERROR(Ratio) || ISBLANK(Ratio), 
            BLANK(), // Mark invalid values (NaN/Infinity/Blank)
            Ratio
        )

    I've optimized the % Bud Color measure:

    % Bud Color = 
    IF(
        ISBLANK([% Bud Clean]), 
        "#808080", // Gray for NaN, Infinity, or Blanks
        IF(
            [% Bud Clean] < 1, 
            "#FF0000", // Red for values < 1
            "#00CC66"  // Green for values >= 1
        )
    )

    Here are the results:

     

     

    Best Regards

    Jianpeng Li

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