cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

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
Community Support
Community Support

Hi @vmao ,

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
Community Support
Community Support

Hi @vmao ,

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

Super User III
Super User III

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
secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors