Forum Discussion
Conditional formatting rows based on blank values in the grand total column with matrix visuals
- 7 months ago
This is a very common Matrix + Grand Total + Conditional Formatting challenge in Power BI. Let’s solve it cleanly and the right DAX way.
Step 1 – Create a helper measure to detect blank Grand Total
Assume your main measure is: [Total Sales]
Create a new measure:
Row Highlight Flag =
VAR GrandTotalValue =
CALCULATE(
[Total Sales],
REMOVEFILTERS( 'Date' ) -- replace with your column used in Columns of matrix
)
RETURN
IF(
ISBLANK( GrandTotalValue ),
1,
0
)Why this works?
- REMOVEFILTERS() forces DAX to calculate Grand Total for that row
- If it’s BLANK(), the row qualifies for formatting
Step 2 – Apply Conditional Formatting
- Select your Matrix visual
- Go to Values → Conditional formatting
- Choose:
- Background color (or Font color)
- Select:
- Format by → Rules
- Based on field → Row Highlight Flag
- Rule setup:
- If value is 1
- Apply your highlight color (e.g., light red or yellow)
This will highlight the entire row, not just one cell.
Common Mistakes to Avoid
Using ISBLANK([Total Sales]) directly
>> That only checks cell-level, not Grand TotalFormatting based on the value column itself
>> Won’t work for row-level logic=================================================================
Did I answer your question? Mark my post as a solution! This will help others on the forum!Appreciate your Kudos!!
Jaywant Thorat | MCT | Data Analytics Coach
LinkedIn: https://www.linkedin.com/in/jaywantthorat/
Join #MissionPowerBIBharat = https://shorturl.at/5ViW9
#MissionPowerBIBharat
LIVE with Jaywant Thorat from 10 Jan 2026
8 Days | 8 Sessions | 1 hr daily | 100% Free - 7 months ago
This is doable, but there’s one important limitation: Power BI does not let you directly reference the Grand Total column in conditional formatting. You have to re-create the same logic in a measure and use that measure for formatting.
Step 1: Create a measure that returns the grand total value :-Grand Total Value = CALCULATE([YourValueMeasure],REMOVEFILTERS( 'YourColumnField' ))
Replace 'YourColumnField' with the field used in Columns of the matrix.
Step 2: Create a flag measure for formatting :-
Highlight Blank Grand Total =
IF(ISBLANK( [Grand Total Value] ),1,0)Step 3: Apply conditional formatting
Select the matrix
Go to Format - Conditional formatting
Choose Background color (or Font color)
Format by: Rules (or Field value)
Base it on: Highlight Blank Grand Total
Rule:
If value = 1 - set highlight color
Else - no color
You can do simple as
But if you want only for grand totals and not intermediate totals,
Create a measure as
Grand Total Color =
IF(
ISFILTERED(YourTable[YourColumn]) && ISINSCOPE(YourTable[YourColumn]) && MIN(YourTable[YourColumn]) = MAX(YourTable[YourColumn]), // Detects grand total
"Red", // Color for grand total
"White" // Default color
)
- Select your Matrix visual.
- Go to the Visualizations pane, find the measure you want to format (e.g.,
Sum of Sales), click the down arrow, and select Conditional formatting > Background color (or Font color, etc.). - In the advanced controls dialog, set Format style to "Field value".
- For "What field should we base this on?", select the color measure you just created (e.g.,
Grand Total Color). - Crucially, in the "Apply to" dropdown, select "Values and Totals" to ensure the formatting applies to both regular cells and grand totals.