Forum Discussion
AC_DATA
6 years agoFrequent Visitor
Indicate RANK 1 Items Among Groups
I am trying to write some DAX for a calculated column that will return the top-ranked item in its group. In the case of the sample data below, I only want to consider records with the STATUS = "SOLD"...
- 6 years ago
Hi AC_DATA
Try this:
Col = VAR Rank_ = RANKX ( FILTER ( Table1; Table1[ITEM] = EARLIER ( Table1[ITEM] ) && Table1[STATUS] = "SOLD" ); Table1[DATE]; ; DESC ) RETURN IF ( Rank_ = 1 && Table1[STATUS] = "SOLD"; Rank_ )Please mark as solved when we get to the solution and consider kudoing if posts are helpful.
Cheers

- 6 years ago
Hi Ac_DATA,
You also could try below measure
Measure 8 = VAR maxd = CALCULATE ( MAX ( 'rank'[date] ), FILTER ( ALLEXCEPT ( 'rank', 'rank'[item] ), 'rank'[status] = "SOLD" ) ) RETURN IF ( MIN ( 'rank'[date] ) = maxd, 1, "" )Best Regards,
Zoe ZhiIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
dax
6 years agoCommunity Support
Hi Ac_DATA,
You also could try below measure
Measure 8 =
VAR maxd =
CALCULATE (
MAX ( 'rank'[date] ),
FILTER ( ALLEXCEPT ( 'rank', 'rank'[item] ), 'rank'[status] = "SOLD" )
)
RETURN
IF ( MIN ( 'rank'[date] ) = maxd, 1, "" )
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.