Forum Discussion
akarca
3 years agoFrequent Visitor
Create table from another table
Hello, I have a table below. I would like to sum monthly volume base and create a new table with the horizontal month columns. Product Volume(kg) Date A 9 6.01.2022 A 1091,975 5.02...
- Anonymous3 years ago
Hi akarca ,
I have created a simple sample, please refer to my pbix fiel to see if it helps you.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY8xDsIwDEXvkgkkS7GdxElGoAdgYqk6IEAMgCqh9v4kLW1DxeDBfnrfdl2r47u99pdOgTq1z/512zzu29RU5+6mGqjVLjUxFSOzJi3zkDASRO8mxtoNbJ+ZxcIZ54fREQski8MDq9LAoGEQu9aGOCaD4ORvJLvogXh9Yo60IoVlyuNNYJh32S/JeRy4IKFwxPhlC2rGeQ8HDBOJE8iKCdGAX+6mCY5fRQS2BSw+FmIIv6j5AA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t, #"(blank).2" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"(blank)", type text}, {"(blank).1", type text}, {"(blank).2", type text}}), #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]), #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Product", type text}, {"Volume(kg)", Int64.Type}, {"Date", type date}}), #"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each Date.MonthName([Date])), #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Date"}), #"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Custom]), "Custom", "Volume(kg)", List.Sum) in #"Pivoted Column"How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ PollyIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Samarth_18
3 years agoCommunity Champion
Hi akarca ,
Do you really need a seperate table since you can achieve this using Matrix Visual by keeping the column as below:-