Forum Discussion

kusanagi's avatar
kusanagi
Frequent Visitor
2 years ago
Solved

Add index column at table view

There is a function in Power Query  of adding Index Column.

Index Column numbered the rows starting from 1 or 0 without repeating numbers.

I need the same function but in table view.

 

I add a new table using summarize, so there is no Power Query for this table.

Is there any dax function having same effect?

  • kusanagi 

    pls try this

    Table 2 = ADDCOLUMNS('Table',"Index",RANKX(all('Table'[Item]),'Table'[Item],,ASC))

4 Replies

  • kusanagi 

    maybe you can try to use rankx to create the index column

    Table 2 = 
    VAR tbl=SUMMARIZE('Table','Table'[id],"amount",sum('Table'[value]))
    return ADDCOLUMNS(tbl,"Index",rankx(all('Table'[id]),'Table'[id],,ASC))

    • kusanagi's avatar
      kusanagi
      Frequent Visitor

      Hi Ryan, 

      Thank for your reply.

       

      I have tried rankx too.

      However, I have plenty item with same amount in my case.

      I don't want same number coming up.

      Here's the example.

      Itemamountrankxwhat I want

      a

      211
      b212
      c433
      d544
      e545

       

      • ryan_mayu's avatar
        ryan_mayu
        Super User

        kusanagi 

        pls try this

        Table 2 = ADDCOLUMNS('Table',"Index",RANKX(all('Table'[Item]),'Table'[Item],,ASC))