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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cris1196
Helper I
Helper I

Ranking by date in dax

Hello everyone

 

I have the following table:

 

Date DayYear_MonthAux
29/11/2022292022492022491129
30/11/2022302022492022491130
1/12/202212022492022491201
2/12/202222022492022491202
3/12/202232022492022491203
4/12/202242022502022501204
5/12/202252022502022501205
6/12/202262022502022501206

-->Date-->dd/mm/yyyy

 

So, my idea is to get the ranking by the group "Year_Month", To achieve it, I used this:

Rank = 
var = variable = 'Table'[Year_Month]
return
RANKX(FILTER('Table', 'Table'[Year_Month]=variable ), 'Table'[Aux],, ASC, DENSE)

 

Date
DayYear_MonthAuxRank
29/11/20222920224920224911291
30/11/20223020224920224911302
1/12/2022120224920224912013
2/12/2022220224920224912024
3/12/2022320224920224912036
4/12/2022420225020225012041
5/12/2022520225020225012052
6/12/2022620225020225012063

 

 

That's ok. Now I want to get the same but without using the Aux column. I've tried, using functions like EARLIER, but unsuccessfully. Does anyone have any idea how to do it?

Thank you

 

PS: I highlighted some columns because the numbers were too close to each other and could be difficult to read

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@cris1196 Try: 

Rank Column = RANKX(FILTER('Table',[Year_Month] = EARLIER('Table'[Year_Month])),[Date],,ASC, DENSE)

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

@cris1196 Try: 

Rank Column = RANKX(FILTER('Table',[Year_Month] = EARLIER('Table'[Year_Month])),[Date],,ASC, DENSE)

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

!It worked. I really need to practice the rankx function more... Thanks!

@cris1196 Don't feel bad: To *Bleep* with RANKX! - Microsoft Power BI Community


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.