+ Reply to Thread
Results 1 to 19 of 19

Power Query - Nested subgroups index on 3 sublevels

  1. #1
    Registered User
    Join Date
    04-25-2024
    Location
    Sydney Australia
    MS-Off Ver
    365
    Posts
    16

    Power Query - Nested subgroups index on 3 sublevels

    Hi,

    I have a source document with columns A,B,C, and D, and I would like to automate the creation of the codes in columns E, F, and G with an Excel power query. My idea was to group and index the headers, then repeat the same for the Subheader and item. The subheader index depends on the headers, ei, each subgroup index restarts at 1.

    I tried many variations using group by and adding a dependent index column. Still, I cannot do this with two levels of grouping, and I couldn't find any video of people attempting something similar.

    Safe to assume this method is not what I need, is there another way to achieve this? I am pretty novice... my head hurts, haha!

    I would be grateful for some assistance.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by Julie.Cooper2; 05-05-2024 at 02:15 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,974

    Re: Power Query - Nested subgroups index on 3 sublevels

    In trying to resolve your issue, I can get part way there, but I have an issue with the Sub Headers. They are all spilled from an array and they will not import into Power Query. If you can amend your workbook to make that data a "working table" or range that is not an array, I will then have a solution for you later today. It is Saturday and it is filled with activity other than Excel.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    04-25-2024
    Location
    Sydney Australia
    MS-Off Ver
    365
    Posts
    16

    Re: Power Query - Nested subgroups index on 3 sublevels

    Thanks, Alansidman, I appreciate your help. Lucky you, it is already Sunday in my part of the world!

    I added a tab with the data set as it will be maintained (CostCentreDataSet) and uploaded the new file to this thread. The cost item tab shows the result I am trying to obtain automatically with the power query.

    I hope this helps and clarifies.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,974

    Re: Power Query - Nested subgroups index on 3 sublevels

    I clearly understand what you want. What I cannot do is bring the sub header table into the Power Query editor as you have arrays in that table. It needs to be a table without any arrays. Only the first two columns of data will import. I have tried to fix it, but that is up to you. If you want additional help here, then you need to make that table data only without any arrays.

  5. #5
    Registered User
    Join Date
    04-25-2024
    Location
    Sydney Australia
    MS-Off Ver
    365
    Posts
    16

    Re: Power Query - Nested subgroups index on 3 sublevels

    My apologies; I clearly do not understand what you mean. The only tab you would use in the file I provided is the CostCentreDataSet. The other tabs are only to demonstrate the end result. The CostCentreDataSet has no arrays/formulas; it only has data. Could you kindly let me know to which tab/column the arrays you are referring to?
    Last edited by Julie.Cooper2; 05-05-2024 at 01:27 AM.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,605

    Re: Power Query - Nested subgroups index on 3 sublevels

    How do you determine what the cost type should be? And what is the issue with just using formulae for this? Why must it be done with PQ?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  7. #7
    Registered User
    Join Date
    04-25-2024
    Location
    Sydney Australia
    MS-Off Ver
    365
    Posts
    16

    Re: Power Query - Nested subgroups index on 3 sublevels

    This is a good point; I was caught up in the first indexation and didn't give this enough thought. As the cost type will be determined simultaneously with the other 3 columns, it should be part of the dataset. ( I have updated the file)
    The reason for the power query is to have a smaller file. We will also create many reports based on this information, and I want the data to be consistent regardless of the user inputs in the dataset. This query is basically a cost centre builder. These codes will be used to import pricing into our ERP.
    Eventually, I also want to create a form for our estimator to create new codes by adding a line in the data set and running a power query to return the codes.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,605

    Re: Power Query - Nested subgroups index on 3 sublevels

    I can't see anything formula-wise that would be likely to bloat your file. With functions in 365, I hardly ever use PQ these days.

    I'll have another look.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,605

    Re: Power Query - Nested subgroups index on 3 sublevels

    The sample workbook has not changed - the new tab still has only three columns, so we'd still need to know how to determine the fourth.

  10. #10
    Registered User
    Join Date
    04-25-2024
    Location
    Sydney Australia
    MS-Off Ver
    365
    Posts
    16

    Re: Power Query - Nested subgroups index on 3 sublevels

    I added a new one, complete data set

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,605

    Re: Power Query - Nested subgroups index on 3 sublevels

    And are these codes correct?

    AliGW on MS365 Beta Channel (Windows 11) 64 bit

    D
    E
    F
    2
    0
    0
    01
    3
    Headers Subheaders 02
    4
    Fees and Insurance Long Service Leave Corporation 03
    5
    Fees and Insurance Bank Guarantees 04
    6
    Fees and Insurance Council & Statutory Fees 01
    7
    Fees and Insurance Insurances 02
    8
    Preliminaries Cleaning and Waste 03
    9
    Preliminaries Site establishment and Protection 04
    10
    Preliminaries Site Labour 05
    11
    Preliminaries Temporary Services 06
    12
    Preliminaries Access Equipment 07
    13
    Preliminaries Builder Equipment 08
    14
    Preliminaries Lift Hoisting 09
    15
    Preliminaries Off Site Labour 01
    16
    Preliminaries Shedding and Facilities 02
    Sheet: Header and Subheaders codes

    They look offset to me.

  12. #12
    Registered User
    Join Date
    04-25-2024
    Location
    Sydney Australia
    MS-Off Ver
    365
    Posts
    16

    Re: Power Query - Nested subgroups index on 3 sublevels

    @AliGW, I have a solution. It is working for me now. Thanks for always being so helpful and patient.

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,605

    Re: Power Query - Nested subgroups index on 3 sublevels

    OK - please share the solution for everyone's benefit.

    If by chance you asked this on other forums, you needed to tell us and provide links to the cross posts (I am sure you are aware of this, though).

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,605

    Re: Power Query - Nested subgroups index on 3 sublevels

    And you need to mark the thread as solved, please.

  15. #15
    Registered User
    Join Date
    04-07-2019
    Location
    Turkey-Ankara-Çubuk
    MS-Off Ver
    Office 2010
    Posts
    69

    Re: Power Query - Nested subgroups index on 3 sublevels

    Hi.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    04-25-2024
    Location
    Sydney Australia
    MS-Off Ver
    365
    Posts
    16

    Re: Power Query - Nested subgroups index on 3 sublevels

    Thanks. I was wondering how to give credit to the person who helped me.

    Solution: https://community.fabric.microsoft.c...891962#M128185

  17. #17
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,605

    Re: Power Query - Nested subgroups index on 3 sublevels

    You can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

    Please mark this thread as solved.
    Last edited by AliGW; 05-06-2024 at 06:58 AM.

  18. #18
    Registered User
    Join Date
    04-25-2024
    Location
    Sydney Australia
    MS-Off Ver
    365
    Posts
    16

    Re: Power Query - Nested subgroups index on 3 sublevels

    Thank you so much for taking the time to do this. This solution almost works, too. The only issue I can see is that the subheader and item codes should only be two digits, never three. For example, 08, 09, 10, 11, 12, etc.

    Is there a way to quickly I could translate this in English?

  19. #19
    Registered User
    Join Date
    04-07-2019
    Location
    Turkey-Ankara-Çubuk
    MS-Off Ver
    Office 2010
    Posts
    69

    Re: Power Query - Nested subgroups index on 3 sublevels

    This is perfect code..
    Please Login or Register  to view this content.
    This is my code.
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Power Query Custom Index Column
    By Dicken in forum Office 365
    Replies: 3
    Last Post: 04-29-2024, 02:37 PM
  2. [SOLVED] Power Query Nested join to bring single column as list
    By Dicken in forum Office 365
    Replies: 2
    Last Post: 02-22-2024, 01:05 PM
  3. Nested Index Match in Power Query
    By afgi in forum Excel General
    Replies: 4
    Last Post: 02-20-2024, 07:53 AM
  4. [SOLVED] Power Query nested if evaluation order
    By Dicken in forum Office 365
    Replies: 5
    Last Post: 01-02-2024, 09:32 AM
  5. Use Row/Index number as Variable in Power Query
    By ptmuldoon in forum Office 365
    Replies: 3
    Last Post: 11-06-2023, 06:03 PM
  6. [SOLVED] INDEX & MATCH not working through a power query
    By DvDj in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-03-2020, 06:27 AM
  7. Sub-Forum for Excel Power Tools (Power Query, Power Pivot & Power BI)
    By chullan88 in forum Suggestions for Improvement
    Replies: 10
    Last Post: 06-28-2018, 02:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1