Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Eric_SCF
Regular Visitor

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.

1 ACCEPTED SOLUTION
Omid_Motamedise
Super User
Super User

Consider your table in power query as bellow

Omid_Motamedise_0-1724970182325.png


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

Omid_Motamedise_1-1724970237835.png

 


If my answer helped solve your issue, please consider marking it as the accepted solution.

View solution in original post

4 REPLIES 4
Eric_SCF
Regular Visitor

Thank you jgeddes as well!  Appreciate the feedback.

Omid_Motamedise
Super User
Super User

Consider your table in power query as bellow

Omid_Motamedise_0-1724970182325.png


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

Omid_Motamedise_1-1724970237835.png

 


If my answer helped solve your issue, please consider marking it as the accepted solution.

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

jgeddes
Super User
Super User

Table.UnpivotOtherColumns() will do that for you.

Table.UnpivotOtherColumns(yourPreviousQueryStep, {"Product"}, "Option", "Price")

You can use Table.Sort() if you need the table sorted.

 

learn.microsoft.com - Table.UnpivotOtherColumns() 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors