Forum Discussion

Eric_SCF's avatar
Eric_SCF
Regular Visitor
1 year ago
Solved

Transposing multiple times?

Hello,

A newbie here to Power Query.  With a minimum of "programming" I would like to transpose this:

 

ProductSub1.1Sub1.2Sub1.3Sub2.1Sub2.2Sub2.3Sub2.4Sub3.1Sub3.2Sub3.3Sub3.4
Prod A100100100110110110110120120120120
Prod B150150150170170170170190190190190
Prod C200200200250250250250300300300300

 

to this:

 

ProductOptionPrice
ASub3.4120
BSub3.4190
CSub3.4300
ASub3.3120
BSub3.3190
CSub3.3300
ASub3.2120
BSub3.2190
CSub3.2300
ASub3.1120
BSub3.1190
CSub3.1300
ASub2.4110
BSub2.4170
CSub2.4250
ASub2.3110
BSub2.3170
CSub2.3250
ASub2.2110
BSub2.2170
CSub2.2250
ASub2.1110
BSub2.1170
CSub2.1250
ASub1.3100
BSub1.3150
CSub1.3200
ASub1.2100
BSub1.2150
CSub1.2200
ASub1.1100
BSub1.1150
CSub1.1200

 

The number of rows and columns in the original data set will vary widely.  There could be 1,000 rows and 500 columns.  I have a VBA macro that does this fairly well but would like to use Power Query instead to make things more transparent and easier to understand for coworkers that may get involved.  Appreciate the feedback in advance.  Thank you.

  • Consider your table in power query as bellow


    then right-click on the product column and pick Unpivot other collumns to reach the next result.

     

4 Replies

  • Consider your table in power query as bellow


    then right-click on the product column and pick Unpivot other collumns to reach the next result.

     

    • Eric_SCF's avatar
      Eric_SCF
      Regular Visitor

      Wow, if everything in life were that easy ......  Thank you very much!

  • Eric_SCF's avatar
    Eric_SCF
    Regular Visitor

    Thank you jgeddes as well!  Appreciate the feedback.