cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Conditional formatting for a text column

Hi PBI community,

 

Is there a way to change the background or font color of a table cell for a text based column using DAX.

 

Any help would be appreciated.

 

Thank you!

13 REPLIES 13
Highlighted
Frequent Visitor

I have found a solution which may help which I got help from one of my team members:

 

  1. Create a number value for the word by creating an additional column. For example 'Yes' as '1' and 'No' as '2'.
  2. Make sure the additonal column value is a whole number and not text.
  3. Apply and close
  4. Go to the field, use the drop down in the fields section and choose 'conditional formatting' - choose Background or Font colour.
  5. Choose 'Rules' for 'Format by'
  6. 'Summarization' as 'Minimum'
  7. Choose the number and the colour If value is '1' then 'Green'
  8. Click OK and it should work 🙂
Highlighted
Anonymous
Not applicable

Perfect, thanks!

Highlighted
Anonymous
Not applicable

Exactly what I was looking for, thanks.  Mind you, being able to apply a format directly to a field based on a text value doesn't seem like it would be that difficult.  It's certainly been something that I could do in Excel for years - come on Microsoft.

Highlighted
Frequent Visitor

This post provides one method: https://exceleratorbi.com.au/conditional-formatting-with-a-text-field-in-power-bi/

 

The DAX is essentially:

Colour Test =
VAR Dept = SELECTEDVALUE(Projects[Department])
RETURN IF(Dept <> BLANK(), "Green", "Red")
 
 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors