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
I am just using desktop, import connection...and will publish on our server, we do not have the cloud.
not sure what you mean by putting this measure in a matrix, this measure= MatrixCellColor ? i thought matrix needed values/numbers so this did not work.
liz
Hi Elizz ,
I appreciate your detailed update and the screenshot it really clarifies things. Since you're working with an import connection rather than live, DAX measures and conditional formatting based on field values should function as intended. The MatrixCellColor measure doesn't need to be displayed in the matrix; it's designed to format the WL measure itself.
You're applying the conditional formatting correctly by selecting MatrixCellColor as the base field for WL. If the formatting still isn't showing, it's likely due to the measure returning BLANK() from a context issue, not outputting valid hex codes like "#FF0000", or a possible rendering problem with your Power BI Desktop version. Test MatrixCellColor in a simple matrix to confirm it's returning values everywhere, and consider updating Power BI Desktop to rule out any bugs. You're on the right path ,if you want a review of your measure logic, feel free to share it.
- Elizz1 year agoFrequent Visitor
thank you, i just tried a simple count of a field in the fact table, and it still doesnt apply the conditional format. i even changed the hex codes to a common pallete colour ive used throughout the report. Im guessing it is down to my version, but getting our IT dept to update it is hard work! haha. i take it there is no other work around on this version?
i will pester my IT dept some more.
i will mark this as helpful as i know it will work with a more uptodate version of PBI.
thank you for all your help - v-sshirivolu1 year agoCommunity Support
Hi Elizz ,
Thank you ! If the response was helpful and your issue is resolved or awaiting a version update, please consider closing the thread by marking it as solved, as this benefits others in the community.