Share via

Power Query - Sub Category Index

Anonymous
2019-07-12T04:09:39+00:00

Hi, 

I want to index my subcategory here mentioned as (Brand) in data such that if head category in columnA changes then subcategory index should start back from 1. Also, I need to further expand it to the sku(Quality) level but Indexing should not be disturbed. 

For small data like in example I did it by making two queries of same data. But I want to do it in one query. Formula variation for below is required for unique records of Subcategory. 

=Table.AddIndexColumn([Data],"Index",1,1) 

For details please see link 

https://1drv.ms/x/s!Av76daN0Fcg9gjOf-2JH3n81F2i3?e=QqiOL1

https://1drv.ms/x/s!Av76daN0Fcg9gjOf-2JH3n81F2i3?e=QqiOL1

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Anonymous
    2019-07-13T05:06:42+00:00

    Thanks Ashish, 

    You have always been remained so helpful. Question is answered. 

    Regards

    Dilawer

    Was this answer helpful?

    0 comments No comments
  2. Ashish Mathur 101.9K Reputation points Volunteer Moderator
    2019-07-13T00:06:08+00:00

    Hi,

    Is your question answered or do you still need help?

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2019-07-12T10:48:00+00:00

    Thanks for reply Nathan, 

    Nathan, if you look at closely to my data then you will realize that there is a complexity that I need indexing against "Brand" column depending upon "Category" column values. At the same time I want to expand "Brand" column further to "Quality" level. 

    What changes I need to do in following formula then

    =Table.AddIndexColumn([Data],"Index",1,1)

    Then, When I expand "Index" column it does not allow me to expand further to "Quality" level. 

    From case shared from your side. I could not figure out similarity. 

    Regards

    Dilawer

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2019-07-12T09:39:34+00:00

    Hi Dilawerhussain,

    I assume that you want to create a grouped index column. Please refer to Bill Szysz' function in the following thread:

    Add a grouped index column - seems way too difficult

    Please let us know if you have any further questions.

    Best Regards,

    Nathan

    Was this answer helpful?

    0 comments No comments