The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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.2022 |
B | 1409 | 5.01.2022 |
C | 10964,16 | 2.02.2022 |
D | 3032,64 | 5.01.2022 |
B | 12130,56 | 5.01.2022 |
C | 12597,12 | 6.01.2022 |
D | 466,56 | 6.03.2022 |
A | 1382,4 | 6.04.2022 |
C | 2822,4 | 6.08.2022 |
A | 6372 | 20.10.2022 |
D | 2808 | 20.09.2022 |
A | 3893,76 | 20.11.2022 |
B | 1290,24 | 5.11.2022 |
B | 1612,8 | 5.11.2022 |
Solved! Go to Solution.
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 _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
You may download my PBI file from here.
Hope this helps.
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 _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello @Samarth_18 , because I will use these tables columns in other tables. Also, I will create different columns like this.
Hi @akarca ,
Do you really need a seperate table since you can achieve this using Matrix Visual by keeping the column as below:-
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin