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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to conditional format a text (string, not number)

I have a field showing Left, Right as text, is that possible to conditional format the words?  So when it is left, red, when it is right, yellow.

 

thank u!

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @Anonymous ,

You could use below measure to create conditional formating(you could use color code to replace color name) 

Measure 3 = switch(MIN('Table (3)'[color]), "left", "red", "right", "#f5dc6c")

 545.PNG

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
dax
Community Support
Community Support

Hi @Anonymous ,

You could use below measure to create conditional formating(you could use color code to replace color name) 

Measure 3 = switch(MIN('Table (3)'[color]), "left", "red", "right", "#f5dc6c")

 545.PNG

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

edhans
Super User
Super User

Not directly, but easy enough to do with a helper column.

 

  1. Create a new column either in Power Query or in a Calculated Column. The following is DAX for a calculated column:
    1. FormatColor = IF(Data[Direction] = "Left","Red","Yellow")
  2. I used a Table visual for this. Put the [Direction] field in the Values section. (Directions is what is returning Right or Left)
  3. CLick the little dropdown arrow for Direction and select Conditional Format, Font ColorFormat by Field Value
  4. Base it on the FormatColor field and summarize by First (latter not relevant but you have to set it to something)

     

    20200110 14_19_48-.png

 

 

 

20200110 14_20_38-Untitled - Power BI Desktop.png



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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