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
Measure for Grand Total check:
Row Has Data =
IF(
ISINSCOPE(YourRowField1) && ISINSCOPE(YourRowField2),
NOT(ISBLANK([YourMeasure])),
NOT(ISBLANK([YourMeasure]))
)
Conditional formatting:
Values field → Conditional formatting → Background color
Format by: Field value → Select [Row Has Data]
Apply to: Values and totals
Rule: = TRUE → Red background
If this answer helped, please click 👍 or Accept as Solution.
-Kedar
LinkedIn: https://www.linkedin.com/in/kedar-pande