Forum Discussion
Create an Incrementing DAX Index column
I am creating a DAX index column that starts from 1 up to the last Row of the table.
I was trying to use
Index Column=GENERATESERIES(1,COUNTROWS(TableName),1)but it returns an error of
A table of multiple values was supplied where a single value was expected Help me correct this formula or have another one that does the same thing...
5 Replies
- Idrissshatila
Super User
Hello Anonymous ,
You could add an index column in power query which will increment automatically
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍
- AnonymousNot applicable
Idrissshatila , no Power Query.It's Inaccessible to me. that's why I need DAX
- v-jingzhang
Community Support
Hi Anonymous
In DAX, we usually use RANKX function to do a similar thing. But with RANKX, we need to provide a column or an expression for sorting as Power BI doesn't have row id in the table. If your table is already sorted by some column e.g. Date, we can use this Date column in the RANKX calculation. Is your table already sorted with some logic? If not, it's difficult to get the Index column.
If possible, can you provide some sample data in table format? I'd like to see if there is any column we can use to create the index (rank) column.
Best Regards,
Community Support Team _ Jing