Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Conditional Formating of Matrix visualization based on slicer ( slected filter)

Hi,
I am new to power bi , I want to compare columns with adjacent ones in Matrix Visualisation based on the BizDate value filters and then mark them with respective colour code on their comparison.

Please consider below table as input:

FilterBizDateBizCount
A20210131Prime100
B20210131Prime101
C20210131Prime102
D20210131Prime103
A20210228Prime105
B20210228Prime90
C20210228Prime91
D20210228Prime92
E20210331Prime93
A20210331Prime105
B20210331Prime80
C20210331Prime70
D20210331Prime100
E20210131Prime90
A20210131Growth111
B20210131Growth102
C20210131Growth103
D20210228Growth104
E20210228Growth105
A20210228Growth100
B20210228Growth91
C20210228Growth92
D20210331Growth93
E20210331Growth500
A20210331Growth89
B20210331Growth90
C20210331Growth88
D20210331Growth1
E20210331Growth2
A20210431Growth10
B20210431Growth20
C20210431Growth30
D20210431Growth40
E20210431Growth50
A20210431Prime50
B20210431Prime40
C20210431Prime30
D20210431Prime20
E20210431Prime10

 

Expected O/P

For Example:
1. for selected three dates values  - I need to compare 20210331(March) Prime values with 20210228 (Feb) Prime values
and base on min and max value on comaprsion i will colour code them.

Same Comparison on Respective Growth Values

Min value - Red Colour

Max Value - Green  Colour

2.Now to compare other two adjacent dates 20210228 (Feb) and 20210131 (Jan) and same colour code i will use to compare the min - max value.
Similarly for N th date i will compare it with N-1th Date (adjacent)

 

Filter202101312021022820210331 20210431
 GrowthPrimeGrowthPrimeGrowthPrimeGrowthPrime
A111100100105891051050
B102101919090802040
C103102929188703030
D104103939211004020
E105 500932905010

 

 

amitchandak 

selimovd

Anonymous

collinq

@wynhopkins

@Jihwan_Kim

@dm-p

  • Hi Anonymous ,

    Has modified the date value you have provided and you can create these measures:

    previous = 
    CALCULATE (
        SUM ( 'Table'[Count] ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[Filter], 'Table'[Biz] ),
            [BizDate]
                = CALCULATE (
                    MAX ( 'Table'[BizDate] ),
                    FILTER ( ALL ( 'Table' ), [BizDate] < MAX ( 'Table'[BizDate] ) )
                )
        )
    )
    format = 
    IF (
        SELECTEDVALUE ( 'Table'[BizDate] )
            = CALCULATE ( MIN ( 'Table'[BizDate] ), ALL ( 'Table' ) ),
        "black",
        IF ( SUM ( 'Table'[Count] ) >= [previous], "green", "red" )
    )

    Set conditional format for the [Count] field:

    Attached a sample file in the below, hopes it could help.

     

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

3 Replies

  • Anonymous , how you plan to select. if you plan to use time intelligence

     

    we can create measures like

     

    MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
    last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

    diff = [MTD Sales]-[last MTD Sales]

     

    and then create a color measure ,

    if([diff] >0, "green", "red")

     

    and use that in conditional formatting using "field value" option

    refer my video: https://www.youtube.com/watch?v=RqBb5eBf_I4

    • Anonymous's avatar
      Anonymous
      Not applicable

      amitchandak  we are not using time intelligence  exaclty, however we are using slicer to select the Dates, which  exists in source only.

      Sample report:

       

       

  • v-yingjl's avatar
    v-yingjl
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

    Has modified the date value you have provided and you can create these measures:

    previous = 
    CALCULATE (
        SUM ( 'Table'[Count] ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[Filter], 'Table'[Biz] ),
            [BizDate]
                = CALCULATE (
                    MAX ( 'Table'[BizDate] ),
                    FILTER ( ALL ( 'Table' ), [BizDate] < MAX ( 'Table'[BizDate] ) )
                )
        )
    )
    format = 
    IF (
        SELECTEDVALUE ( 'Table'[BizDate] )
            = CALCULATE ( MIN ( 'Table'[BizDate] ), ALL ( 'Table' ) ),
        "black",
        IF ( SUM ( 'Table'[Count] ) >= [previous], "green", "red" )
    )

    Set conditional format for the [Count] field:

    Attached a sample file in the below, hopes it could help.

     

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