To apply dynamic conditional formatting in a Power BI matrix table based on multiple conditions, follow these steps:
1. Create a DAX Measure for Conditional Logic
Define a measure that evaluates multiple conditions, such as target achievement and trend direction:
FormatColor =
VAR SalesValue = SELECTEDVALUE(Sales[Amount])
VAR Target = SELECTEDVALUE(Sales[Target])
VAR Trend = SELECTEDVALUE(Sales[Trend])
RETURN
SWITCH(
TRUE(),
SalesValue >= Target && Trend = "Up", "#008000", -- Green for above target & positive trend
SalesValue < Target && Trend = "Down", "#FF0000", -- Red for below target & negative trend
SalesValue < Target && Trend = "Up", "#FFA500", -- Orange for below target but improving
"#FFFFFF" -- Default White
)
2. Implement Conditional Formatting Using DAX Measure
Select Matrix visual → Open Format pane → Conditional Formatting
Select the field to be formatted (e.g., Sales Amount)
Format style - Field value
Format using Measure FormatColor
3. Dynamic Update Based on User Selections
If the slicers or filters affect the conditions, the measure will recalculate dynamically
For further flexibility, add ALL SELECTED () in the measure.