Forum Discussion

flushedpeach's avatar
flushedpeach
Regular Visitor
7 months ago
Solved

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?


Thank you!

  • 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.

5 Replies

  • 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.

  • 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!

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

  • v-karpurapud's avatar
    v-karpurapud
    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.