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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
kman42
Helper III
Helper III

RANKX by date

I'm trying to rank some records by the date, but I'm getting rather unexpected results. Here's my column formula:

 

Screen Shot 2019-10-30 at 5.05.26 PM.png

 

 

But here's the result I'm getting:

 

Screen Shot 2019-10-30 at 5.03.25 PM.png

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @kman42 ,

When I use your expression to create a column, it returns "1" for each row. But, when use it to create a measure, it works well.

If you want to create a column, try this:

Date Rank Index 2 column = RANKX ( 'award', 'award'[award_begin_date],, DESC )

 

rank1.PNGrank2.PNG

 

Best Regards,
Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi,

Write these 2 measures

Begin_Date = MIN(Award[award_begin_date])

Rank_Date = RANKX(ALLSELECTED(Award[award_begin_date]),[Begin_Date],,DESC)

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hello Ashish,

I was trying to implement your solution but I'm getting an error:

Rank_date = CALCULATE(ALLSELECTED('Weekly data'[Start of Week]),[Begin_Date],,DESC)
"Argument '3' in CALCULATE function is required."

Hi,

Replace CALCULATE with RANKX


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Oh how I didn't notice it! Thank you so much. 

If you allow I have one more question, is there a way to reverse columns order with dates by having this measure created? Don't really know how to do this.column_reverse.jpg

You are welcome.  I do not understand your question.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

So I would like to change the order of columns, the first column should be 4/1/2024 and the last should be 1/1/2024. I was thinking that creating this measure with rank could help me, but still no idea how to manage it. Hope it's more clear now. 

Icey
Community Support
Community Support

Hi @kman42 ,

When I use your expression to create a column, it returns "1" for each row. But, when use it to create a measure, it works well.

If you want to create a column, try this:

Date Rank Index 2 column = RANKX ( 'award', 'award'[award_begin_date],, DESC )

 

rank1.PNGrank2.PNG

 

Best Regards,
Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.