To add advanced conditional formatting to a matrix visual based on multiple DAX measures, the recommended approach is to create a separate DAX measure that encapsulates your logic, then use it as the basis for conditional formatting.
Here’s how to do it:
Create a Formatting Measure: Write a new DAX measure that evaluates the condition between your actuals and targets—e.g., returns color hex codes or numeric thresholds based on variance logic (e.g., green for above target, red for below).
FormatColor =
SWITCH(
TRUE(),
[Actual] >= [Target], "#4CAF50", // Green
[Actual] < [Target], "#F44336", // Red
"#9E9E9E" // Gray for others
)
Apply Conditional Formatting: In the matrix visual, go to Values > Conditional formatting > Background color (or Font color). Choose Format by: Field value and select your custom formatting measure.
Ensure Measure Context: Make sure the formatting measure works correctly in the matrix's context—especially with row and column combinations—so that the logic evaluates per cell accurately.
This method gives you full control over complex formatting scenarios and allows you to apply formatting logic that spans across multiple measures or KPIs in a single matrix visual.