Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Idrissshatila , no Power Query.It's Inaccessible to me. that's why I need DAX

      • v-jingzhang's avatar
        v-jingzhang
        Icon for Community Support rankCommunity 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