Forum Discussion

CrystalC's avatar
CrystalC
New Member
3 years ago
Solved

Conditional Formatting broken by Custom Sort

Hi all, I was able to create a custom (non-alphabetic) sort order for column headers and rows, and I also want to apply conditional formatting to color-code the 1st and 2nd ranking values across a r...
  • v-jialluo-msft's avatar
    3 years ago

    Hi CrystalC ,

     

    Please follow these steps:

    (1) My test data:

     

    (2) Add a new measure

    CF Rank =
    
    VAR _max =
    
        CALCULATE (
    
            MAX ( 'Mockup'[Sched Dprts] ),
    
            ALLEXCEPT ( Mockup, 'Mockup'[Carrier] )
    
        )
    
    VAR _nextmax =
    
        CALCULATE (
    
            MAX ( 'Mockup'[Sched Dprts] ),
    
            FILTER ( ALL ( Mockup ), [Sched Dprts] < _max )
    
        )
    
    RETURN
    
        SWITCH ( SUM ( Mockup[Sched Dprts] ), _max, "Green", _nextmax, "Yellow" )
    
    

     

    (3) The result is as follows :

     

    Best Regards,

    Gallen Luo

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.