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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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. It helps others in the community find answers faster—and keeps the community growing stronger!
You can also check out my YouTube channel for tutorials, tips, and real-world solutions in Power Query with the following link
https://youtube.com/@omidbi?si=96Bo-ZsSwOx0Z36h

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. It helps others in the community find answers faster—and keeps the community growing stronger!
You can also check out my YouTube channel for tutorials, tips, and real-world solutions in Power Query with the following link
https://youtube.com/@omidbi?si=96Bo-ZsSwOx0Z36h

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.