Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kirvis
Helper I
Helper I

Add column that restarts counting for each new category

Hi all,

 

I am trying to add a number column that restarts counting every time a new category starts.

 

Example:

 

Cat  CustomColumn

A     1

A     2

A     3

B     1

B     2

B     3

C     1

C     2

C     3

 

In Excel, this is very easy, but in Power Query I have a hard time achieving this.

 

Any ideas?

 

Thanks,

 

Kirvis

 

1 ACCEPTED SOLUTION
rainer1
Resolver III
Resolver III

Hi, 

you can achieve this with the grouping function and then index it.

A nice Article about it is her.

https://www.excelguru.ca/blog/2018/06/27/number-rows-by-group-using-power-query/

 

-------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!
It was useful? Press Thumbs Up!

View solution in original post

2 REPLIES 2
rainer1
Resolver III
Resolver III

Hi, 

you can achieve this with the grouping function and then index it.

A nice Article about it is her.

https://www.excelguru.ca/blog/2018/06/27/number-rows-by-group-using-power-query/

 

-------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!
It was useful? Press Thumbs Up!

Ah yes, excellent! That is exactly what I needed!

Thanks!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors