Search code examples
excelpowerbipowerquerypowerbi-desktopm

Powerquery - Index column which restarts based on a grouped column


I have a table which contains 2000 entries. I want to add an index column to the table which will "reset" for each unique entrie in another column.

Hopefully the below table will help explain it

Team Name Library Name Index
Team 1 January 1
Team 1 January 2
Team 1 January 3
Team 1 February 1
Team 1 February 2
Team 1 February 3
Team 1 March 1
Team 1 March 2
Team 1 March 3
Team 1 March 4
Team 1 April 1
Team 1 April 2
Team 1 April 3
Team 1 April 4
Team 1 April 5

I just can't get my head around how to achieve this. Any ideas would be appreciated.


Solution

  • Start table:

    enter image description here

    Group by:

    enter image description here

    Add new column:

    enter image description here

    Expand and remove old columns:

    enter image description here