Forum Discussion

Max_Petti's avatar
Max_Petti
Copper Contributor
Mar 01, 2023
Solved

Power Query Data Stacking/Unstacking Inquiry

Hello,

I have a table which is formatted as followed:

Account #Owner 1 NameOwner 1 SSNOwner 1 DOBOwner 1 EmailOwner 2 NameOwner 2 SSNOwner 2 DOBOwner 2 EmailOwner 3 NameOwner 3 SSNOwner 3 DOBOwner 3 Email
1John Smith12312312312/12/1950email address removed for privacy reasonsSally Smith32132132112/12/1960email address removed for privacy reasonsAdam Smith11122233312/12/1970email address removed for privacy reasons
2John Smith12312312312/12/1950email address removed for privacy reasons       
3John Smith12312312312/12/1950email address removed for privacy reasonsAdam Smith11122233312/12/1970email address removed for privacy reasons    


each row represents an account in which 1, or more owners may be listed.  These owneres may also be listed on additional rows, and may also appear in differing sections (i.e owner 1, 2, 3 sets of headers to accomodate data gathering)

My goal is to use power query to transform the table to the following format:

Account #Owner NameOwner SSNOwner DOBOwner Email
1John Smith12312312312/12/1950email address removed for privacy reasons
1Sally Smith32132132112/12/1960email address removed for privacy reasons
1Adam Smith11122233312/12/1970email address removed for privacy reasons
2John Smith12312312312/12/1950email address removed for privacy reasons
3John Smith12312312312/12/1950email address removed for privacy reasons
3Adam Smith11122233312/12/1970email address removed for privacy reasons

I want to create a continguous/stacked data set for all account owners across multiple sets of columns, to just one set of columns to capture owner data.

Please let me know if anything is unclear, or if additional clarification is needed!

Thank You,

  • Max_Petti 

    You can try this Power Query suggestion. In the attached file you can add data to the large blue dynamic table. Then you can click in any cell of the green table and right-click with the mouse and select refresh to update the green result table.


    The data layout in the screenshot and in the attached file is for illustration. You can place the green result table to the right of the blue table or in another worksheet.

3 Replies

  • Max_Petti 

    You can try this Power Query suggestion. In the attached file you can add data to the large blue dynamic table. Then you can click in any cell of the green table and right-click with the mouse and select refresh to update the green result table.


    The data layout in the screenshot and in the attached file is for illustration. You can place the green result table to the right of the blue table or in another worksheet.

    • Max_Petti's avatar
      Max_Petti
      Copper Contributor

      OliverScheurich Thank you, this looks great.

      Would it be possible by chance to list/provide a screenshot of your applied steps for transformation?  I unfortunately am not able to open the file at this time.

      Disregard - I was able to open the file.  Another question, would the steps work if i were to enter partial records? i.e. missing a DOB, or email?

      • OliverScheurich's avatar
        OliverScheurich
        Gold Contributor

        Max_Petti 

        You are welcome. The solution doesn't work for partial records. It requires all the information which is expected in the output table (name, ssn, dob and email).

Resources