Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Peter_
Resolver I
Resolver I

Filter on Date Rank Measure

Hi,

 

I'm trying to create measures which give me 1st, 2nd, 3rd date labels from the latest available date going back and it should depend on dates selected in a date range slicer. This works for the 1st label, i.e. when a date rank below is 1, but not for the others. Is there anything obviously wrong with the DAX expressions I'm using?

 

Date Rank measure

Date Rank =
RANKX( ALLSELECTED(Table[Aggregation Date]), CALCULATE(MAX(Table[Aggregation Date])), , DESC)
 
Date Label measures
[Date[Rank 1]] Label] = "as of " & UNICHAR(10) & CALCULATE(MAX(Table[Aggregation Date]), FILTER(Table, Table[Date Rank] = 1))
[Date[Rank 2]] Label] = "as of " & UNICHAR(10) & CALCULATE(MAX(Table[Aggregation Date]), FILTER(Table, Table[Date Rank] = 2))
 
Putting this into I table where there are two dates {11/17, 11/20} I get following:
 
 image.png
Setting the end of slicer to exclude 11/20, Date[Rank 1] Label updates to 11/17 as expected
 
image.png
 
 
1 ACCEPTED SOLUTION
Peter_
Resolver I
Resolver I

With a help from http://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures and experimentation via CONCATENATEX to see what values are being passed through the Calculate wasn't the way to go to implement this. Following measure does what I want:

[Date[Rank 1]] Label] = "as of " & UNICHAR(10) & FILTER(ALLSELECTED(Table[Aggregation Date]), [Date Rank] = 1)

View solution in original post

1 REPLY 1
Peter_
Resolver I
Resolver I

With a help from http://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures and experimentation via CONCATENATEX to see what values are being passed through the Calculate wasn't the way to go to implement this. Following measure does what I want:

[Date[Rank 1]] Label] = "as of " & UNICHAR(10) & FILTER(ALLSELECTED(Table[Aggregation Date]), [Date Rank] = 1)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.