Forum Discussion
How do I apply conditional formatting to text column in a Matrix Visual?
I am trying to apply conditional formatting on a Text Field (in Rows) with a MATRIX Visual. IF the Text is Status yes or Status #1 then change color or font. This doesn’t seem possible unless it’s a table?
If Text Column = yes/1 for status then Bold/highlight
| Store | Text | sales | net |
| X1 | abc | 103 | 541 |
| X2 | def | 139 | 65 |
| X4 | ghi | 12 | 6 |
| X5 | jkl | 223 | 56 |
| X6 | mno | 13 | 569 |
| X8 | pqr | 23 | 698 |
dataset has following fields available as well for reference
| Text | Status | Status # |
| abc | yes | 1 |
| def | yes | 1 |
| ghi | no | 2 |
| jkl | no | 2 |
| mno | yes | 1 |
| pqr | yes | 1 |
8 Replies
- mahoneypatMicrosoft Employee
You can make a measure that evaluates the value in the status column and returns 0 or 1, and then set conditional formatting on that measure using a field value or rule in Color Scale. For example,
ColorMeasure = IF(SELECTEDVALUE(Table[Status])="yes",1,0)
And then make a color rule on the desired column for if it is >=1.
Please see this link for more info - https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-numbers-in-the-column
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
- powerbihelp87Helper V
Thanks mahoneypat for looking into this. I am able to get this to work in a table but not a MAtrix Text Field. Do you know how I can get this to work for a MAtrix Text field? you cannot apply conditional formatting to a text in Matrix
- amitchandakSuper User
powerbihelp87 , You can create a color measure . That return color
Color Date = var _min =minx(allselected(Date,Date[Year]) return Switch( true(), FIRSTNONBLANK('Date'[Year],year(TODAY()))-_min =0 ,"lightgreen", FIRSTNONBLANK('Date'[Year],year(TODAY()))-_min =0 ,"blue", "red") if(FIRSTNONBLANK(Table[Col1],"ABC") "ABC","green","red")You can use that in conditional formatting after choosing the field option. and use this measure.
refer
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- powerbihelp87Helper V
amitchandak thanks for the help but I dont know if this will help conditional format my "rows" in the matrix?
0
- amitchandakSuper User
powerbihelp87 , color measure needs to be used only in conditional formatting. There is no row formatting, you have to format all column using same measures