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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Conditional formatting for Text Fields

Hi there,

 

I have a matrix which brings in Overall Status Assessment that is a text field that contains Red, Amber & Green. I would like to do conditional formatting which uses icons however it seems that conditional formatting can only be done using number fields.

 

So I'm thinking that I need to create a new measure called Overall Status Number with IF statements I guess that does the following:

 

If Red then 1

If Amber then 2

If Green then 3

 

This way, I can use this in the conditional formatting rules that brings in either red, amber or green based on whether it's 1, 2 or 3.

 

Table Name = Work

Field Name with Red, Amber & Green = Overall Status Assessment

New Measure to be created Overall Status Number

 

I hope I'm on the right track. If not please advise how else I can do this.

 

ddroz_0-1665461637703.png

 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi Arul,

 

Thanks, I got it to work. Just Power BI not playing nice, so instead of copying & pasting in the measure formula that you provided, I re-wrote it manually which then invokes the auto-populate feature for functions and it worked.

 

Thanks

Darren

 

View solution in original post

can you mark my measure as solution, thx

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi Arul,

 

Thanks, I got it to work. Just Power BI not playing nice, so instead of copying & pasting in the measure formula that you provided, I re-wrote it manually which then invokes the auto-populate feature for functions and it worked.

 

Thanks

Darren

 

can you mark my measure as solution, thx

Anonymous
Not applicable

Thanks Arul,

 

I think I still must be doing something wrong. 

 

1. When I bring in the Overall Status Assessment into a standalone table, all good as expected it returns the red, amber, green.

ddroz_0-1665467213384.png

2. The numbers Measure formula is accepted as you provided, so all good there.

ddroz_1-1665467286691.png

 

3. When I bring in the New Numbers Measure itself to appear as a table with just that field it errors and then when I try bring it in into the table together with the Overall Status, it errors.

ddroz_2-1665467536247.png

 

4. And then finally, which is what I'm actually trying to do with the conditional formatting to set icons based on the value of 1, 2 or 3.

ddroz_4-1665468007909.png

 

It errors. 

ddroz_5-1665468044589.png

 

Any further help you can provide would be greatly appreciated,

 

Thanks

Darren

 

 

 

 

 

 

 

Whats the error message in "See details"?

lukiz84
Memorable Member
Memorable Member

Hi,

 

try 

 

NumbersMeasure = 
   VAR rowValue = SELECTEDVALUE(Work[Overall Status Assessment])
   RETURN SWITCH(
      TRUE(),
      rowValue = "Red", 1,
      rowValue = "Amber", 2,
      rowValue = "Green", 3,
      -1
    )
Arul
Super User
Super User

@Anonymous ,

you are on a right track and you also consider below method as well,

https://community.powerbi.com/t5/Desktop/Conditional-Formatting-Text-Field/m-p/1661482 

Thanks,





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors