Forum Discussion

techhelp's avatar
techhelp
New Member
7 months ago
Solved

Conditional formatting rows based on blank values in the grand total column with matrix visuals

I have a matrix visual and I turned on the grand total column setting. I want to create a conditional formatting rule that will highlight all rows where the grand total column value is blank. 
  • Jaywant-Thorat's avatar
    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

    1. Select your Matrix visual
    2. Go to Values → Conditional formatting
    3. Choose:
      • Background color (or Font color)
    4. Select:
      • Format by → Rules
      • Based on field → Row Highlight Flag
    5. 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 Total

    Formatting 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

  • Amar_Kumar's avatar
    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

    1. Select the matrix

    2. Go to Format - Conditional formatting

    3. Choose Background color (or Font color)

    4. Format by: Rules (or Field value)

    5. Base it on: Highlight Blank Grand Total

    6. Rule:

      • If value = 1 - set highlight color

      • Else - no color