Forum Discussion

NaveenMD's avatar
NaveenMD
Icon for Helper I rankHelper I
2 years ago

Ranking each cell in column from conditional formatting

What I am trying to achieved is column value based conditional formatting ie. if my value in cell 1 > value in cell 2 then  cell 1 should be in darker shade.

 

I believe this can be easily implemented if I rank the values in the matrix.

 In my specific usecase the values in the rows (ie. row labels)  will be filtered using filters option in power BI so the dax should act accordingly.

 

 

This is a test table that has been created.

 

The table on the left has values  which can be ranked as shown in table on the ringht.

 

 

 

amitchandak Daniel29195  please support

5 Replies

  • Daniel29195's avatar
    Daniel29195
    Icon for Community Champion rankCommunity Champion

    NaveenMD 

    use 

    rankx  and allselected() function .

     

    measure_sales amount = 

    sales amount = sum(tbl_name[col_name]) 

     

    measure rank = 

    rankx  ( allselected ( tbl_name[col_name] )  , [sales amount] ,  asc ) 

     

     

    hope this helps .

     

    NB :  the idea is to use allselected () so that the rankx act according to your filters .

    change the tbl_name and col_name with your appropriate names  from your model .

     

     

    If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution ✅
    It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

      • Daniel29195's avatar
        Daniel29195
        Icon for Community Champion rankCommunity Champion

        NaveenMD 

        did you use  allselected  on the colummn having the values  A,B,C,D ...  ?