Forum Discussion
How can I create a simple index column with dax.
- 7 years ago
Yep it works. Thanks
- 6 years ago
gtamir - Oh, then you want my SuperRank column formula, which I just invented:
SuperRank = VAR __table = FILTER(ALL('Table6'),[Total] > EARLIER('Table6'[Total])) VAR __tableSame = FILTER(ALL('Table6'),[Total] = EARLIER('Table6'[Total]) && [Customer] < EARLIER(Table6[Customer])) RETURN COUNTROWS(__table) + 1 + COUNTROWS(__tableSame)Attaching PBIX, you want Table6.
- 6 years ago
gtamir That is correct as written. You have to have some secondary identifier, you cannot just magically assign the ranks when things tie. You could use actual Index column in your query and then use that as your secondary identifier and that would ensure that you would never get the same rank twice.
Greg_Deckler Greg, just now I noticed that RANKX ranks the same value as the same rank. I need something like row number.
gtamir - Oh, then you want my SuperRank column formula, which I just invented:
SuperRank =
VAR __table = FILTER(ALL('Table6'),[Total] > EARLIER('Table6'[Total]))
VAR __tableSame = FILTER(ALL('Table6'),[Total] = EARLIER('Table6'[Total]) && [Customer] < EARLIER(Table6[Customer]))
RETURN
COUNTROWS(__table) + 1 + COUNTROWS(__tableSame)
Attaching PBIX, you want Table6.
- Greg_Deckler6 years ago
Community Champion
gtamir That is correct as written. You have to have some secondary identifier, you cannot just magically assign the ranks when things tie. You could use actual Index column in your query and then use that as your secondary identifier and that would ensure that you would never get the same rank twice.
- MAAbdullah_475 years ago
Helper V
Hi Greg_Deckler
Please note that (Earlier) Is not supported by DAX now , try to check another solution.
- gtamir6 years ago
Post Patron
Thank you for the quick response. I'll try it and try to understand..
I'll let you know.
- gtamir6 years ago
Post Patron
Greg_Deckler It works BUT, if there are two identical names the index will be the same.
- lbendlin4 years ago
Super User
It's still supported but it is deprecated. Use variables instead.
- Dax_Doodle3 years agoNew Member
🙂 Good one!