Forum Discussion

sebsenciel's avatar
sebsenciel
Frequent Visitor
2 years ago
Solved

POWERBI : MATRIX - GROUP and HEADER and COLORS

Hello, I have a big problem that I can't solve with PowerBi I want to make the following report :     from the following table : management rules : If the value in column "INDIC1" ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    HI sebsenciel,

    AFAIK, current conditional formatting feature not able to directly apply to the matrix visual header field and total levels. If you mean to apply condition formatting on value field based on current row and column field values, it is possible.

    I'd like to suggest you do unpivot columns on these 'INDIC' fields to convert them to attribute and value.

    Unpivot columns - Power Query | Microsoft Learn

    Then you can add variables to extract the current field values and use them compare with conditions to get result color code.

    Sample measure formulas:

    ValueColor =
    VAR currDate =
        MAX ( Table1[Date] )
    VAR currAttr =
        SELECTEDVALUE ( Table1[Attribute] )
    VAR currValue =
        SELECTEDVALUE ( Table1[Value] )
    RETURN
        SWITCH (
            currAttr,
            "INDIC1", SWITCH ( currValue, "V", "GREEN", "F", "RED", "BLACK" ),
            "INDIC2", IF ( currValue = "a ", "YELLOW", "BLACK" ),
            "BLACK"
        )
        
    DateColor =
    IF ( currDate < TODAY (), "GREEN", "RED" )
    

    After these steps, you can use these formulas on value and date field background color to achieve your requirement.

    Regards,

    Xiaoxin Sheng