Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jimbob2285
Advocate III
Advocate III

Matrix, Cell Element, Background Conditional Formatting - don't apply to column totals

I have a matrix, whose rows show types of quotes with a total quotes below (row totals) and the columns are lead times and the values are the number of quotes

 

I want to conditionally format columns that are past their lead time in red and those that are not yet due in green.  I can;t apply conditional formatting to specific columns because it's a matrix, not a table - So I'm applying background conditional formatting to cell elements instead.  I'm also applying them to Values & Totals so that the row totals at the bottom of the grid are also colour coded the same.

 

Which seems to be working fine, until we look at the column totals... and the subtotals are conditionally formatted, which is fine, but so is the grand total, and I don't want it to be - but I can't find a way not to have the grand totals unformatted, as they're currently green, indicating it's a good number, when in fact it's a combination of a bad and good number (bad being overdue, good being not yet due)

 

It's probably easier to look at the images below - it;s the grand total on the far RHS ofthe matrix, that I don;t want conditionally formatted... and what decided it should be green, rather than red:

Matrix.pngFormatting.png

1 ACCEPTED SOLUTION
AndrewGould
Frequent Visitor

Hi,

Can you do this with a measure?  Here's a basic example:

 

Cell Colour = SWITCH(
    TRUE(),
    SELECTEDVALUE('QCD Period L2'[QCD Period L2]) = "Today", "Yellow",
    SELECTEDVALUE('QCD Period L2'[QCD Period L2]) = "1 Month + Past QCD", "Grey",
    CONTAINSSTRING(SELECTEDVALUE('QCD Period L2'[QCD Period L2]), "-"), "Red",
    CONTAINSSTRING(SELECTEDVALUE('QCD Period L2'[QCD Period L2]), "+"), "Green",
    SELECTEDVALUE('QCD Days'[QCD Days]) = "Past QCD", "Red",
    SELECTEDVALUE('QCD Days'[QCD Days]) = "Due", "Green"
)
 
You could then assign this to the Background Color conditional format rather than using the rules you defined
 
AndrewGould_0-1722531591367.png

 

And the result (sorry about the gross colours!):

AndrewGould_1-1722531619192.png

 

 

View solution in original post

3 REPLIES 3
AndrewGould
Frequent Visitor

Hi,

Can you do this with a measure?  Here's a basic example:

 

Cell Colour = SWITCH(
    TRUE(),
    SELECTEDVALUE('QCD Period L2'[QCD Period L2]) = "Today", "Yellow",
    SELECTEDVALUE('QCD Period L2'[QCD Period L2]) = "1 Month + Past QCD", "Grey",
    CONTAINSSTRING(SELECTEDVALUE('QCD Period L2'[QCD Period L2]), "-"), "Red",
    CONTAINSSTRING(SELECTEDVALUE('QCD Period L2'[QCD Period L2]), "+"), "Green",
    SELECTEDVALUE('QCD Days'[QCD Days]) = "Past QCD", "Red",
    SELECTEDVALUE('QCD Days'[QCD Days]) = "Due", "Green"
)
 
You could then assign this to the Background Color conditional format rather than using the rules you defined
 
AndrewGould_0-1722531591367.png

 

And the result (sorry about the gross colours!):

AndrewGould_1-1722531619192.png

 

 

Thanks Andrew, I thought about using a measure, but couldn't see how it would produce a different result - I would have never got there without your help and didn;t realise you could apply the measure to different levels within the matrix

Excellent, happy to hear that it helped!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.