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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Ryanc2258
Helper I
Helper I

Power BI conditional formatting text

Hello

I would like to set the conditional formatting of color for the lable column as below. I tried several measure in this community, and it does not work. It appears the isssu is caused by the special character in the column text. Please help.

 

Thanks

JIN

Ryanc2258_0-1595525345668.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Ryanc2258 , if you have created a measure like these

Color sales = if(AVERAGE(Sales[Sales Amount])<170,"green","red")
Color Year = if(FIRSTNONBLANK(Table[Year],2014) <=2016,"lightgreen",if(FIRSTNONBLANK(Table[Year],2014)>2018,"red","yellow"))

Color  = if(FIRSTNONBLANK(Table[Year],2014) <=2016 && AVERAGE(Sales[Sales Amount])<170 
,"lightgreen",if(FIRSTNONBLANK(Table[Year],2014)>2018,"red","yellow"))
Color sales = if([Sales Today] -[sales yesterday]>0,"green","red")

 

In conditional formatting, you have to choose field option and then this measure.

 

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

 

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Ryanc2258 ,

How did you make conditional formatting for Label field? Set the background color of Lable filed to the color in the double quotes of the corresponding field value? If yes, you can create a measure as below and format Label field base on this new created measure... I created a sample pbix file for you, you can also get other methods from the sample file.

Measure = 
VAR _label =
    MAX ( 'Conditional Formatting_2'[Label] )
VAR _llabel =
    LEFT ( _label, LEN ( _label ) - 1 )
RETURN
    RIGHT ( _llabel, LEN ( _llabel ) - 1 )

Conditional formatting.JPG

Best Regards

Rena

Issue solved. Thank you very much. 

amitchandak
Super User
Super User

@Ryanc2258 , if you have created a measure like these

Color sales = if(AVERAGE(Sales[Sales Amount])<170,"green","red")
Color Year = if(FIRSTNONBLANK(Table[Year],2014) <=2016,"lightgreen",if(FIRSTNONBLANK(Table[Year],2014)>2018,"red","yellow"))

Color  = if(FIRSTNONBLANK(Table[Year],2014) <=2016 && AVERAGE(Sales[Sales Amount])<170 
,"lightgreen",if(FIRSTNONBLANK(Table[Year],2014)>2018,"red","yellow"))
Color sales = if([Sales Today] -[sales yesterday]>0,"green","red")

 

In conditional formatting, you have to choose field option and then this measure.

 

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

 

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.