Forum Discussion
How can I create a simple index column with dax.
I want to create a simple index column starting with 1 next to the total column.
I can't do it with query editor because it is a calculated table.
Giora
Yep it works. Thanks
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.
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.
16 Replies
- Greg_Deckler
Community Champion
I created a calculation called Sequential once, but this is going to depend on what is in your table, can you share that or an example?
https://community.powerbi.com/t5/Quick-Measures-Gallery/Sequential/m-p/380231
Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
- gtamir
Post Patron
It is very simple. I have a column TOTAL sorted descending. Next to it I need an index starting with 1.
The table is created with DAX so I can't do it with query editor.
Giora
- AnonymousNot applicable
See if this solution helps:
https://community.powerbi.com/t5/Desktop/Add-calculated-index-column-by-DAX/td-p/72448