Forum Discussion
Edit Table with Calculation Items
- Anonymous9 months ago
Hi AlissaStuart ,
Thank you for reaching out to Microsoft fabric community forum.
Since your rows are generated from a calculation group, the Matrix can't directly apply color to the row headers. However, you can still achieve clear row banding by coloring the values according to the calculation item in each row. To do this, create a simple color measure that checks the selected calc item (using SELECTEDVALUE('Calc Group'[Name])) and returns a hex color with a SWITCH statement, assigning each item or subgroup a specific color. To handle totals, use IF(NOT ISINSCOPE('Calc Group'[Name]), BLANK(), <color>). Then, in the Matrix, use Conditional formatting - Background color - Field value and select this color measure for the Values/Totals. This will shade each data row by calc item, giving you the subgroup highlights you want without changing your calc group setup. If you have many items, consider adding a [Subgroup] column to the calc group table and use it in your SWITCH to keep color assignments organized.
Create calculation groups in Power BI - Power BI | Microsoft Learn
Hope this helps. Please reach out for further assistance.
Thank you.
Hi legenda689 ,
The behavior you're experiencing is normal, as calculation items cannot be referenced using [MeasureName]. Instead, in a calculation group, you should compare against the calculation item name text. Please modify your color measure so that the SWITCH function checks the item names as listed in your Calculation Items.
Conditional Format =
SWITCH(
SELECTEDVALUE( 'Calculation group'[Calculation group column] ),
"Job Starts", "#72c197",
"Job Starts YouthHSN", "#FFFF66",
BLANK()
)
Once you've updated the measure, navigate to Conditional Formatting > Background color > Field Value and choose this measure. This will return the correct color hex based on the selected calculation item, allowing the matrix to apply row shading as intended.
This method will ensure that row-level coloring functions properly for calculation groups.
Thank you.