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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
omaffud
Frequent Visitor

Conditional formatting all values using text condition

I am trying to do a conditional formatting, but it looks like because of the summarization, it only formats the first value. See condition below. How can I fix that?

omaffud_0-1711400829669.png

omaffud_1-1711400930964.png

 

 

2 REPLIES 2
PhilipTreacy
Super User
Super User

Hi @omaffud 

 

Download PBIX file with the example below

 

You need to create a measure that determines the color, then apply that measure in the Conditional Formatting.

 

Heres an example measure using Hex color codes, change these to whatever you want.  You can look up Hex color codes online, here's one place HTML Color Picker (w3schools.com)

 

 

CF = 

VAR _status = SELECTEDVALUE('DataTable'[Item Status])

RETURN

SWITCH( TRUE(),

    _status = "Cancelled", "#f00",

    _status = "Re-Validated", "#ff0",

    _status = "PL Rejected", "#f0f",

    "#0f0"
)

 

 

Then create Conditional Formatting that uses this measure to apply color to the Status column

 

cfstat.png

 

cfrule2.png

 

You can also use well known color names rather than Hex color codes.  See section 4.3 here CSS Color Module Level 3 (w3.org)

 

Further Reading: see the section 'Color based on a calculation' Apply conditional table formatting in Power BI - Power BI | Microsoft Learn

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Phil,

 

almost there, but as you can see below, most of the times, the color is not being applied.

 

omaffud_0-1711986153762.png

 

My code:

StatusColor =

VAR _status = SELECTEDVALUE(QuoteItems[ItemStatus])

RETURN

SWITCH( TRUE(),

    _status = "Cancelled", "#f16a75",

    _status = "Re-Validated", "#00ce00",

    _status = "PL Rejected", "#f16a75",

    _status = "Quoted", "#00ce00",

    _status = "Awaiting PL Review", "#ffcc00",

    _status = "Pending Quote", "#ffcc00",

    "#00ce00"
)
 
My rule:
omaffud_1-1711986233367.png

Any clue?

 

Thanks in advance,

Omaffud

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 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.