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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
StuartSmith
Power Participant
Power Participant

Conditional Formatting based on cards text value.

I previously posted this question (https://community.powerbi.com/t5/Desktop/Card-Visual-Text-Colour-based-on-card-content/td-p/804248) and was given the below answer that would make the "Font" red on a card if the card value said "CLOSED".  

 

FontColor = IF(CONTAINSSTRING([AddressMeasure],"Closed"),"#FF0000","#000000")

I am currently working on a report that has roughly 25 cards and therefore I would have to create 1 measure for each card, so 25 measures.  Is there a way that I could have 1 generic measure that could be placed in "ANY" card conditional formatting section.

 

Something like... FontColor = IF(CONTAINSSTRING([Any_Measure],"Yes"),"#FF0000","#000000")

 

 

2 REPLIES 2
swise001
Continued Contributor
Continued Contributor

  @StuartSmith 

You will create one measure that handles the color logic - and then you refer to that measure in the conditional formatting section of the visual.  Something similar to this  -- just change out the <= for  [yourmeasure] = "yourtext"

 

 

 

 

Color Selector =
SWITCH (
    TRUE (),
    [Win %] <= 0.40, "#FF0000",
    [Win %] <= 0.65, "#FFCC00",
    [Win %] <= 1, "#00FF00"
)

 

 

 

 

Set conditional formatting on any part of the visual (table column, card data label, card category label, etc) that has reference to Win%

Select "Field Value" and the color measure you created. 

 

swise001_0-1597938284984.png

Instant color!

And you can reuse this method across your whole report

swise001_2-1597938591922.png

 

 

 

 

amitchandak
Super User
Super User

@StuartSmith , this video has technique to reduce measure refer

 

https://www.youtube.com/watch?v=vlnx7QUVYME from GuyinaCube

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.