Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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:

 

 

 

But here's the result I'm getting:

 

  • Hi Anonymous ,

    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 )

     

     

    Best Regards,
    Icey

     

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

7 Replies

  • Icey's avatar
    Icey
    Community Support

    Hi Anonymous ,

    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 )

     

     

    Best Regards,
    Icey

     

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

  • 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.

    • WaldemarVogt's avatar
      WaldemarVogt
      Regular Visitor

      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."