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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Conditional Formatting font text Amber

Is there a way to change the font colour of a text column [BRAG STATUS] with the values "Green", "Amber" & "Red"

 

I'm able to use conditional formatting to get a value by field for the first values (see pic attached) but it doesn't pick up the amber colour:Colour Formatting.GIF

I've even tried to use a switch function to change the HEX colours but I still cant quite get it

 

Conditional Colour Format = SWITCH(TRUE(),MAX(audit_results[BRAG STATUS])="Green",1,MAX(audit_results[BRAG STATUS])="Amber",2,MAX(audit_results[BRAG STATUS])="Red",3)

 

Any help on this would be great!

 

Thanks,

1 ACCEPTED SOLUTION
nandukrishnavs
Super User
Super User

@Anonymous 

 

 

BRAG STATUS Column2
Red 1
Amber 2
Green 3
Red 4
Amber 5
Green 6
Red 2

 

DAX measure

 

Conditional_Colour_Format =
VAR __status =
    CALCULATE ( FIRSTNONBLANK ( audit_results[BRAG STATUS], TRUE () ) )
VAR __color =
    SWITCH ( __status, "Green", "#4CAF50", "Amber", "#FFC107", "Red", "#f44336" )
RETURN
    __color

Capture.JPGCapture.JPG

 

 
 

Regards,
Nandu Krishna

View solution in original post

4 REPLIES 4
nandukrishnavs
Super User
Super User

@Anonymous 

 

 

BRAG STATUS Column2
Red 1
Amber 2
Green 3
Red 4
Amber 5
Green 6
Red 2

 

DAX measure

 

Conditional_Colour_Format =
VAR __status =
    CALCULATE ( FIRSTNONBLANK ( audit_results[BRAG STATUS], TRUE () ) )
VAR __color =
    SWITCH ( __status, "Green", "#4CAF50", "Amber", "#FFC107", "Red", "#f44336" )
RETURN
    __color

Capture.JPGCapture.JPG

 

 
 

Regards,
Nandu Krishna

amitchandak
Super User
Super User

@Anonymous , As per this Amber is supported

https://blog.crossjoin.co.uk/2018/08/10/colour-names-supported-in-power-bi-conditional-formatting/

 

Hexcode you have to return with #. Hope you are using "Field" option and measure. Make sure you created a measure not column

 

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

 

color =
switch ( true(),
FIRSTNONBLANK(Table[commodity],"NA") ="commodity1" && sum(Table[Value]) >500,"lightgreen",
FIRSTNONBLANK(Table[commodity],"NA") ="commodity2" && sum(Table[Value]) >1000,"lightgreen",
/// Add more conditions
"red"
)
Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

I have this measure but it cant load the data for the visual:

 

color =
switch ( true(),
FIRSTNONBLANK('audit_results'[BRAG STATUS],"NA") ="GREEN" && sum('audit_results'[BRAG STATUS]) ="GREEN","lightgreen",
FIRSTNONBLANK('audit_results'[BRAG STATUS],"NA") ="RED" && sum('audit_results'[BRAG STATUS]) = "RED","red",
)
 
 
The error is "MdxScript(Model) (22,70) Calculation error in measure 'audit_results'[color]: The function SUM cannot work with values of type String

HI @Anonymous ,

 

See if this helps.

 

https://exceleratorbi.com.au/conditional-formatting-with-a-text-field-in-power-bi/

 

Regards,

Harsh Nathani

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 MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.