Forum Discussion
rsrajkumar
1 year agoHelper I
Transform and Transpose data
Hi, I have loaded the below data form an excel file: Column 1 MTD YTD Orders A 3.0 5.0 B 8.0 10.0 C 2.0 3.0 D 7.0 8.0 Sales A 7.0 9.0 ...
- 1 year ago
Hey rsrajkumar,
Your input table is a single table or there are 3 separate ones? If the former, then you can try these steps in Power Query (just paste the code in Advanced Editor to see it in action):
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8i9KSS0qVtJRUgDjWJ1oJUcgy1jPAEiaAkmQiBOQbQEWMTSACjkDOUZgIWOoiAuQbQ4WsYCKKKAYG5yYk4ppEUSHJZJFhqYQm8yRbII4xwzJJogic6w2BRTlp2WWYFhlhqIFZJUJirEIL5kgWWSI8GQsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Product = _t, MTD = _t, YTD = _t]), #"Added Custom" = Table.AddColumn(Source, "Category", each if [Product] = "Orders" or [Product] = "Sales" or[Product] = "Profit" then [Product] else null), #"Filled Down" = Table.FillDown(#"Added Custom",{"Category"}), #"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([Product] <> " " and [Product] <> "Sales" and [Product] <> "Orders" and [Product] <> "Profit")), #"Reordered Columns" = Table.ReorderColumns(#"Filtered Rows",{"Category", "Product", "MTD", "YTD"}) in #"Reordered Columns"Output table:
- 1 year ago
pls see the attachment below
- 1 year ago
ryan_mayu Thank you very much!
ryan_mayu
1 year agoSuper User
pls see the attachment below
rsrajkumar
1 year agoHelper I
ryan_mayu Thank you very much!
- ryan_mayu1 year agoSuper User
you are welcome