Forum Discussion
Rank duplicate ID based on date
Good day! Im facing a small issue but would help a lot when solved. My dataset shows the following:
| Job | PU Date |
| 1 | 01/01/23 |
| 1 | 01/02/23 |
| 1 | 01/03/23 |
| 2 | 01/01/23 |
| 3 | 01/01/23 |
| 3 | 01/02/23 |
However I need a new column (in query editor) to rank them like the following:
| Job | PU Date | Step | |
| 1 | 01/01/23 | 1 | |
| 1 | 01/02/23 | 2 | |
| 1 | 01/03/23 | 3 | |
| 2 | 01/01/23 | 1 | |
| 3 | 01/01/23 | 1 | |
| 3 | 01/02/23 | 2 |
Would help me out a lot if someone has the solution for me! Table is called 'Jobs Ranked'
Thank you!
Hi Anonymous
Add a calculated column with the dax code :
Ranking =RANKX(FILTER(ALL('Table (2)'),'Table (2)'[Job] = EARLIER('Table (2)'[Job])),'Table (2)'[PU Date],,ASC)If this post helps, then please consider Accepting it as the solution to help the other
members find it more quickly
Hi Anonymous for ranking with POWER QUERY please refer to the linked tutorial
https://www.youtube.com/watch?v=ej60Wxaum_E
If this post helps, then please consider Accepting it as the solution to help the other
members find it more quickly
6 Replies
- Ritaf1983Super User
Hi Anonymous
Add a calculated column with the dax code :
Ranking =RANKX(FILTER(ALL('Table (2)'),'Table (2)'[Job] = EARLIER('Table (2)'[Job])),'Table (2)'[PU Date],,ASC)If this post helps, then please consider Accepting it as the solution to help the other
members find it more quickly
- AnonymousNot applicable
Hello! Thank you but this is not the option I'm looking for. This works for table view in the report but wom't show the data in query editor. I need to have it in Query editor to go further with new steps. Do you know how to achieve this?
- Ritaf1983Super User
Hi Anonymous for ranking with POWER QUERY please refer to the linked tutorial
https://www.youtube.com/watch?v=ej60Wxaum_E
If this post helps, then please consider Accepting it as the solution to help the other
members find it more quickly