Forum Discussion

djoellet's avatar
djoellet
Frequent Visitor
2 years ago

Conditional formatting in a matrix for whitespace analysis

If we are selling a certain product, we may be unable to offer another product/service line.  I would like to format fields in a matrix based on text in other fields; please see the image below.  This was built using a product column and a client column, the X represents products the clients have purchased.  I want the product fields that we cannot offer to be grey. Is it possible to recreate this in PBI?

 

 

Thank you

1 Reply

  • Hi djoellet ,

     

    Based on the information provided, your conditional formatting measure would go something like this:

    conditional formatting =
    VAR __PROD =
        SELECTEDVALUE ( data[product] )
    VAR __PROD_A =
        CALCULATE ( [my measure], data[product] = "A" )
    VAR __PROD_B =
        CALCULATE ( [my measure], data[product] = "B" )
    VAR __PROD_C =
        CALCULATE ( [my measure], data[product] = "C" )
    RETURN
        IF (
            (
                NOT ( ISBLANK ( __PROD_A ) )
                    && __PROD IN { "B", "D" }
            )
                || (
                    NOT ( ISBLANK ( __PROD_B ) )
                        && __PROD = "D"
                )
                || (
                    NOT ( ISBLANK ( __PROD_C ) )
                        && __PROD IN { "D", "E" }
                ),
            "gray"
        )
    

     

    Replace [my measure] witht the actual measure you use for X and gray with another color or hexadecimal code. Gray's hex is #808080 but it may vary depending on the hue you want.