Forum Discussion

Jarrodg's avatar
Jarrodg
New Member
2 years ago
Solved

M Lanuage code to create index values for each field value

Hi,

 

I am trying to write a script that will generate an index number for each value in the "Entity" field. Here is a sample of the output I want to create. I have tried using the Group function in combination with the AddIndexColumn function but I cannot get them to produce this outcome. Any suggestions please? 

 

 

  • =Table.Combine(Table.Group(PreviousStepName,"Entity",{"n",each Table.AddIndexColumn(_,"Index",1)})[n])

1 Reply

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

    =Table.Combine(Table.Group(PreviousStepName,"Entity",{"n",each Table.AddIndexColumn(_,"Index",1)})[n])