Forum Discussion
conditional Formatting in Calculation Item
- 7 months ago
Thankyou, MFelix, burakkaragoz and cengizhanarslan for your responses.
Hi Mniknejad,Thank you for the update.
Based on my understanding, when multiple calculation groups are placed on Matrix columns in Power BI, the calculation item context is not preserved during visual rendering. Conditional formatting is evaluated after the DAX query completes, by which time the identity of specific calculation items is no longer reliably available. Consequently, visual level conditional formatting cannot consistently determine which calculation item produced a given value, and therefore may be unreliable in this scenario.
Please consider the following workarounds, which may help resolve the issue:
- Move scenario logic out of calculation groups on columns. Instead, use explicit measures or a Scenario dimension. Limit to at most one calculation group affecting columns. This preserves formatting context and ensures reliable behavior.
- Split the matrix into separate visuals. One for base values and another for variance values that require conditional formatting. This approach avoids loss of calculation group context at render time.
If you require calc-item-scoped conditional formatting across multiple calculation groups, please raise an idea on the Ideas forum using the link:Fabric Ideas - Microsoft Fabric Community
We hope this information helps resolve the issue. If you have any further queries, please feel free to contact the Microsoft Fabric community.
Thank you.
In a calc-group matrix, ISNUMBER() often looks “false” because the cell is getting a formatted value (or the measure is being coerced), even though the underlying value is numeric. So use SELECTEDMEASURE() + calc-item detection.
Create one measure just for formatting:
Font Color (Scenario) =
VAR v = SELECTEDMEASURE()
VAR scen = SELECTEDVALUE ( 'Scenario'[Scenario] ) -- your calc group column name
RETURN
IF (
scen IN { "LE % Var", "LY % Var" } && v < 0,
"#C00000",
"#000000"
)
Then apply it in the matrix:
Conditional formatting → Font color → Format by: Field value → Font Color (Scenario).
For parentheses, do it with a dynamic format string on the calc items (not with FORMAT() in the measure), e.g. on LE % Var / LY % Var items set a format like:
#,0.0%;(#,0.0%)
That gives parentheses automatically for negatives while keeping the value numeric, so conditional formatting still works.
If you currently have FORMAT() anywhere in the calc items (or in KPI_Value_Visible_CAD), remove it — that’s the #1 reason the matrix treats the result as text and blocks numeric-driven formatting.