Conditional Formatting with DAX is not applying chosen colors to field that contains string data

Viewed 30

I have a column in a matrix that needs to have a red or green background based on the text value for that row. I have a DAX measure that, based on plenty of research, should achieve this result. However, rather than showing a red or green background, it is showing "Red" or "Green" text. I am not sure how to apply conditional formatting because it is a text field, and as far as I can tell, conditional formatting in Power BI only likes numbers. I am very new to Power BI, so I may be totally off base, but not for lack of effort!

Here is my DAX:

Status = 
VAR active = IF(SELECTEDVALUE('Utilization'[emStatus]) = "A", True, False)
VAR down = IF(SELECTEDVALUE('Utilization'[emStatus]) = "D", True, False)

RETURN
IF(ISINSCOPE(Utilization[Equipment]), /*True*/ SWITCH(TRUE(),
                                            active , "Green",
                                            down, "Red"
                                            ), 
/*False*/ Blank())

Here is an image of my current result:

enter image description here

Any and all help is appreciated!

1 Answers

You can return colours as you have done in conditional formatting. Make sure you choose the field value option.

enter image description here

Related