Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Snagalapur
Helper IV
Helper IV

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])

Snagalapur_0-1739878838103.png

 

EX:

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

 

1 ACCEPTED SOLUTION
DataNinja777
Super User
Super User

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,

View solution in original post

2 REPLIES 2
DataNinja777
Super User
Super User

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,

amitchandak
Super User
Super User

@Snagalapur , Based on what I got, You can create a measure like below and use conditional formatting using fx option and field values

 

COlor = if([% Bud] <.9, "Red", "Green")

 

How to do conditional formatting by measure and apply it on pie?
https://www.youtube.com/watch?v=RqBb5eBf_I4&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
https://community.powerbi.com/t5/Community-Blog/Power-BI-Conditional-formatting-the-Pie-Visual/ba-p/...
https://amitchandak.medium.com/power-bi-where-is-the-conditional-formatting-option-in-new-format-pan...

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.