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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
flushedpeach
Regular Visitor

Need Background Color for Matrix Table at individual row level at category row level

Hi! I am trying to apply background color conditional formatting to the following table (Current Month Column). I am able to succeed with individual rows in matrix but now the category row values. The following matrix calc is what I'm using for color coding:
Color Coding

VAR RawTxt =
    SWITCH(
        TRUE(),
        -- Metric row
        ISINSCOPE(UnionTable[Metric]),
            [Matrix Calc - Overall Evaluation],
        -- Category subtotal row (Category in scope, Metric not)
        ISINSCOPE(UnionTable[Category]) && NOT ISINSCOPE(UnionTable[Metric]),
            CALCULATE(
                [Matrix Calc - Overall Evaluation],
                REMOVEFILTERS(UnionTable[Metric])
            ),
        -- Anything else (grand total, etc.)
        BLANK()
    )
-- Normalize text (prevents subtotal weirdness with invisible spaces)
VAR Txt0 = COALESCE(RawTxt, "")
VAR Txt1 = SUBSTITUTE(Txt0, UNICHAR(160), " ")
VAR Txt  = TRIM(Txt1)
RETURN
SWITCH(
    TRUE(),
    Txt = "", BLANK(),
    CONTAINSSTRING(Txt, "Outside 5pts") && CONTAINSSTRING(Txt, "Green"), 2,  -- yellow
    CONTAINSSTRING(Txt, "Red"), 1,                                           -- red
    CONTAINSSTRING(Txt, "Green"), 0,                                         -- green
    -1
)


Any idea as to why background color is not working for category rows?
Screenshot 2026-01-23 110318.png

Thank you!

1 ACCEPTED SOLUTION
d_m_LNK
Super User
Super User

This is because the filter context is getting more than one value to evaluate for those rows.  Because you are evaluating the strings on those rows, the rollup rows have more than one string to evaluate so they return blank and therefore no color.

-----------------------
Did this help?
Drop a kudo so others can find it ! 😄
Mark as a solution if it helped you make progress on your issue 😃

View solution in original post

5 REPLIES 5
v-karpurapud
Community Support
Community Support

Hi @flushedpeach 

We have not received a response from you regarding the query and were following up to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.

 

Thank You.

v-karpurapud
Community Support
Community Support

Hi @flushedpeach 


Thank you for reaching out to the Microsoft Fabric Community Forum. 

Please take a moment to review the details shared by @d_m_LNK , @krishnakanth240 , @pcoley  and confirm whether they align with your expectations. Let us know if you require any additional assistance or clarification.

Regards,

Microsoft Fabric Community Support Team

pcoley
Solution Supplier
Solution Supplier

Please check this article 
https://www.sqlbi.com/articles/distinguishing-hasonevalue-from-isinscope/

Please try without "&& NOT ISINSCOPE(UnionTable[Metric])"


I hope this helps.
If so please Mark it as a solution.
Kudos are Welcome!
krishnakanth240
Resident Rockstar
Resident Rockstar

Hi @flushedpeach 

 

Can you please confirm for which column / columns (category row values.) from the above screenshot, you want to provide Color coding measure. If you can share the sample data, can check on this. Thank You!

d_m_LNK
Super User
Super User

This is because the filter context is getting more than one value to evaluate for those rows.  Because you are evaluating the strings on those rows, the rollup rows have more than one string to evaluate so they return blank and therefore no color.

-----------------------
Did this help?
Drop a kudo so others can find it ! 😄
Mark as a solution if it helped you make progress on your issue 😃

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.