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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
cavedweller
New Member

Trying to manipulate table. Seems like a combination of transposing, pivoting and duplicating

Hi there,

 

I have a table in Power Query that I'm trying to manipulate.  Unfortunately, the format in which I receive it is very different than what I have to change it to and I'm tryning to speed the process up.

 

Basically, as show in the table on the top of the image, I have items running down the first column and a series of sizes and locations running across the rest of the columns.  What I'm trying to do is convert the table to look like the one at the bottom of the image.  For every cell that has a number in it, I want to create another row, one for each size that's in inventory, and move the numbers to the respective row. 

 

I think it's pretty clear, but that might be because I've been looking at it for hours.  😕

 

Thanks for any help you can provide!PQ sample.jpg

1 ACCEPTED SOLUTION
AlienSx
Super User
Super User

hi

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    unp = Table.UnpivotOtherColumns(Source, {"Item"}, "Attribute", "Value"),
    spl = Table.SplitColumn(unp, "Attribute", Splitter.SplitTextByDelimiter("_", QuoteStyle.Csv), {"Size", "loco"}),
    pvt = Table.Pivot(spl, List.Distinct(spl[loco]), "loco", "Value", List.Sum)
in
    pvt

View solution in original post

2 REPLIES 2
AlienSx
Super User
Super User

hi

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    unp = Table.UnpivotOtherColumns(Source, {"Item"}, "Attribute", "Value"),
    spl = Table.SplitColumn(unp, "Attribute", Splitter.SplitTextByDelimiter("_", QuoteStyle.Csv), {"Size", "loco"}),
    pvt = Table.Pivot(spl, List.Distinct(spl[loco]), "loco", "Value", List.Sum)
in
    pvt

That was perfect!  Thanks so much!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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