March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
Register NowGet certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Hello there,
I have a set of data as below in a pivot form from the 4th columns.
The first row is read as Supplier AG produce Product Line of Footwear with total component weight of 300 kg. There are two components in the 300 kg, Rubber that made up of 40%, 120kg and Cotton that made up of 60%, 180kg.
I am planning to transform/clean the table into Table 2 using power query, by removing "total component weight (kg)" and combine "component 1" and component 2" into single columns with adding rows.
I figure out to use split Table 1 into 2, Component 1 and Component 2, and then append them. It is getting complicated because there might be more Component, 3, 4, 5 etc. in Table 1.
I tried unpivot column 4th to 6th, but I am stuck at the steps to combine the "Component" columns into one. May I have some suggestions on this? Thank you!
Solved! Go to Solution.
NewStep=#table({"Supplier","Product Line","Component","Component %","Weight (kg)"},List.TransformMany(Table.ToRows(PreviousStepName),each List.Select(List.Split(List.Skip(_,3),3),each Text.From(_{0}??"")<>""),(x,y)=>List.FirstN(x,2)&y))
thank you!! it worked pretty well.
NewStep=#table({"Supplier","Product Line","Component","Component %","Weight (kg)"},List.TransformMany(Table.ToRows(PreviousStepName),each List.Select(List.Split(List.Skip(_,3),3),each Text.From(_{0}??"")<>""),(x,y)=>List.FirstN(x,2)&y))
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
Check out the November 2024 Power BI update to learn about new features.
User | Count |
---|---|
61 | |
55 | |
27 | |
17 | |
13 |