Forum Discussion
mrskool
7 years agoFrequent Visitor
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...
- 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

AlB
Community Champion
7 years agoHi 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 ![]()
- mrskool7 years agoFrequent Visitor
Thanks! That worked! I was lost in the row context... Your code helped me understand where I was off on the wrong path!