Forum Discussion

mrskool's avatar
mrskool
Frequent Visitor
7 years ago
Solved

DAX Ranking over a group, status flag and sequence columns

Hello - I have been trying to wrap my brain around using a DAX calculated column to get a ranking over a group by status flag and sequence. The status flag that goes between 1 and 0.   The SK, seque...
  • AlB's avatar
    7 years ago

    Hi mrskool 

     

    NewCol =
    VAR PreviousFlagSeq_ =
        CALCULATE (
                MAX ( Table4[sequence] );
                Table4[flag] <> EARLIER ( Table4[flag] );
                Table4[sequence] < EARLIER ( Table4[sequence] );
                ALLEXCEPT ( Table4; Table4[SK] )
        ) + 0
    RETURN
        Table4[sequence] - PreviousFlagSeq_
    

    Please mark the question solved when we get to the solution and consider kudoing if posts are helpful.

     

    Cheers  Datanaut