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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
oldnapkin
Regular Visitor

Need help with RANKX within a date range

I want to numerically rank an amount within a specific date. Say my data is this.

 

Person	Sales	Date
Bob	10	January
Jeff	20	January
Steve	30	January
Bob	50	February
Jeff	40	February
Steve	30	February
Bob	20	March
Jeff	30	March
Steve	10	March

 

 

 I want to be able to see their ranks with a month and also for the entire year. Like this.

 

Person	Sales	Date	Month Rank	Year Rank
Bob	10	January	3	2
Jeff	20	January	2	1
Steve	30	January	1	3
Bob	50	February	1	2
Jeff	40	February	2	1
Steve	30	February	3	3
Bob	20	March	2	2
Jeff	30	March	1	1
Steve	10	March	3	3

 

I'm having difficulty getting the ranks within the months. It ranks each record individually so in this case it shows ranks 1-9. 

 

Thanks!

1 ACCEPTED SOLUTION
v-caliao-msft
Microsoft Employee
Microsoft Employee

@oldnapkin,

 

MonthRank = RANKX(FILTER(Sales,Sales[Date]=EARLIER(Sales[Date])),Sales[Sales],,DESC)

YearRank = RANKX(Sales,CALCULATE(SUM(Sales[Sales]),ALLEXCEPT(Sales,Sales[Person])),,DESC,Dense)

Capture.PNG

 

Regards,

Charlie Liao

View solution in original post

1 REPLY 1
v-caliao-msft
Microsoft Employee
Microsoft Employee

@oldnapkin,

 

MonthRank = RANKX(FILTER(Sales,Sales[Date]=EARLIER(Sales[Date])),Sales[Sales],,DESC)

YearRank = RANKX(Sales,CALCULATE(SUM(Sales[Sales]),ALLEXCEPT(Sales,Sales[Person])),,DESC,Dense)

Capture.PNG

 

Regards,

Charlie Liao

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.