Forum Discussion

jcastr02's avatar
jcastr02
Post Prodigy
1 year ago
Solved

Rearrange columns

I am trying to rearrange my columns in power query to stack on top of each other.  I have to stack all like columns together...see example below and desired outcome.  How could I achieve this in PQ? ...
  • PwerQueryKees's avatar
    PwerQueryKees
    1 year ago

    Three stores I see. I would use the same approach.
    Any number of stores?
    Is doable, but will take som complex coding.
    Something along the lines of:

    1. Demote the headers (if you didn't already)
    2. Make a list of all the sub tables by looking at the total number of columns and using Table.Columnnames() and List.Range to get the column names to select
    3. Table.Combine(the_list_you_just_created)