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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
jimbob2285
Advocate IV
Advocate IV

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.