Forum Discussion
Matrix table conditional format based on row and column fields not values
- 1 year ago
Hi Elizz
Thanks for reaching out to the Microsoft fabric community forum.
Create Conditional Formatting DAX Measure -
MatrixCellColor =
VAR _Status = SELECTEDVALUE(Appointments[Status])
VAR _Week = SELECTEDVALUE(Appointments[Week])
RETURN
SWITCH(
TRUE(),
_Status = "TCI After Breach", "#FF6B6B",
_Status = "PastTCI", "#FF6B6B",
_Status = "TCI Before Breach", "#5DADE2",
_Status = "Pending" && _Week <= 5, "#5DADE2",
_Status = "Pending" && _Week > 5, "#FF6B6B",
"#FFFFFF"
)
Apply Conditional Formatting
In Visualizations pane go to Values - dropdown - Conditional formatting - Background colorSelect :
Format by: Field value
Based on field: MatrixCellColor
Please find the below attached .pbix file for your reference.
Regards,
Sreeteja
Hi Elizz ,
Follow these steps to get it working.
Click on the Matrix visual. Then, in the Visualizations pane at bottom-right corner, you'll see the 'Values' section where you can drag fields to display data."
Then, click the down arrow next to the field under the 'Values' section. You'll see the 'Conditional formatting' option - select it, and then choose 'Background color' to apply color formatting.
Then, select the field or measure you want to apply the formatting to under 'Based on field'. This lets you control the background color based on a specific value or measure.
thanks, but when i select the Dax measure it doesnt let me select it. it wont allow me to select any measures only fields. i do have a measure in my value as it sums all 3 fact tables (waitlists) together.
- v-sshirivolu1 year agoCommunity Support
Hi Elizz ,
I'm able to select the measure for conditional formatting, as you can see in the screenshot below.Key Checks Before Applying Conditional Formatting with a Measure
Make sure that your DAX measure is returning a text value (like a hex color code) and was created using "New measure", not a column. Also, ensure you're formatting the correct value field in the matrix.- Elizz1 year agoFrequent Visitor
Hi, thank you
i can select the measure but it wont apply. i think it could be to do with the version i am on, i can select the measure if i opt for Rules instead if field value but of course that needs to be a number format. I am also not doing just a sum of the value in the value, i have a measure called WL which i have left in the formula bar as i need to count all 3 different waitlists
- danextian1 year agoSuper User
Are you perhaps using live connection? Because this setup wont accept a measure that is created locally to be used for conditional formatting. If not, can you show put this measure in a matrix?