• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Power Query - add column which groups matches in a column, and gives each group and index number

Rob 888

New Member
So I have a column that has genuine duplicates. I want be able to give each group it's own indexing sequence.

so it would look something like this.

AAA 1
AAA 2
BBB 1
CCC 1
CCC 2
AAA 3
CCC 3
CCC 4

I can get as far as highlighting the column, and selecting the Group by option, and choosing 'All rows'.
This creates a count column with 'table' value inside each grouped row. When I click 'table' in one of the rows, it shows be a subset of the date but just for the value of the row initially selected.
I can then add an index column, and at that point for that specific grouped row it looks correct. But of course that is only for the row I selected, and I need this to be applied to all the rows.

Any help would be appreciated
 
Last edited:
Change the group step formula to something like this:

Code:
= Table.Group(Source, {"Column1"}, {{"Data", each Table.AddIndexColumn(_, "Index", 1)}})

(assumes the column to group on is called Column1). You can then remove the original column and just expand the new table column.
 
Change the group step formula to something like this:

Code:
= Table.Group(Source, {"Column1"}, {{"Data", each Table.AddIndexColumn(_, "Index", 1)}})

(assumes the column to group on is called Column1). You can then remove the original column and just expand the new table column.
thank you so much, that has worked perfectly :)
 
Back
Top