Forum Discussion

Snagalapur's avatar
Snagalapur
Helper IV
1 year ago
Solved

Cards - Conditional format

Hi All,

How to conditional format cards using formula. i would like to colour red or Green based on values using formula. Kindly suggest.

% Bud = SUM( [actual_op])/SUM( [budget])

 

EX:

IF(SELECTEDVALUE('Variance'[Variance]) = "%", IF([% Gth] = "*", "#000000", IF([% Gth] < .01, "#FF0000", "#00CC66")),BLANK()) 

 

  • Hi Snagalapur ,

     

    To conditionally format a Card Visual in Power BI based on the % Bud measure, you need to create a DAX measure that defines the color logic and then apply it to the card’s formatting options.

    First, define a new measure that evaluates the value of % Bud and assigns a color based on the threshold. If the value is less than 100%, it should be red (#FF0000), and if it is 100% or more, it should be green (#00CC66).

    % Bud Color =
    VAR Value = SUM([actual_op]) / SUM([budget])
    RETURN
        IF(Value < 1, "#FF0000", "#00CC66")
    

    Once the measure is created, go to the Card Visual displaying the % Bud value. In the Visualizations pane, navigate to the Format Your Visual section (paint roller icon), expand Callout Value, and click on the fx (Function) Icon next to the Color option. In the pop-up window, select Format by → Field Value and choose the newly created % Bud Color measure. Click OK to apply the changes.

    This setup ensures that the card dynamically changes color, turning green when the budget percentage is ≥ 100% and red when it is below 100%.

     

    Best regards,

2 Replies