Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

PowerBI Conditional Formatting Based on Slicer

Hello, 

 

I have a slicer which gives the option to choose between Japan, Korea or both. I also have a Target for each which changes for Japan, Korea or total - so what I mean is that if Japan is chosen my current value should be compared to a 15% and conditional formatted accordingly. If Korea is chose it should be compared to 16% and if both are chosen then it should be compared to 14.5%.  Kindly advise how I can conditional format according to the restriction above.

  • Hi, Anonymous ;

    You could create a measure such as:

    measure =
    SWITCH (
        SELECTEDVALUE ( 'table'[country] ),
        "Japan", SUM ( [value] ) - 0.15,
        "Korea", SUM ( [value] ) - 0.16,
        IF (
            CALCULATE (
                DISTINCTCOUNT ( 'table'[country] ),
                FILTER ( ALLSELECTED ( 'table' ), [country] IN { "Korea", "Japan" } )
            ) = 2,
            SUM ( [value] ) - 0.145
        )
    )
    


    Best Regards,
    Community Support Team _ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Icon for Community Support rankCommunity Support

    Hi, Anonymous ;

    You could create a measure such as:

    measure =
    SWITCH (
        SELECTEDVALUE ( 'table'[country] ),
        "Japan", SUM ( [value] ) - 0.15,
        "Korea", SUM ( [value] ) - 0.16,
        IF (
            CALCULATE (
                DISTINCTCOUNT ( 'table'[country] ),
                FILTER ( ALLSELECTED ( 'table' ), [country] IN { "Korea", "Japan" } )
            ) = 2,
            SUM ( [value] ) - 0.145
        )
    )
    


    Best Regards,
    Community Support Team _ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.