Forum Discussion
acbg
Resolver III
8 years agoPivot multiple month columns
I have a dataset which comes across normalized with 3 different months under month column. This needs to be pivoted has columns in a table for users. Issue is the 3 months changes. I ca...
- 8 years ago
Hi acbg,
Based on my test, you should rebulid your visual here. As I can reproduce your issue here. Or if you just add rows in your data source, then everything should go well.
Regards,
Frank
v-frfei-msft
Community Support
8 years agoHi acbg,
I made a sample as below. We can Pivot the Month column based on the sales column.
Here is the M code in power query for your reference.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8s3PK8kwVNJRAuFEpVgdJCEjIE5CFTIG4mRUIRMgTkEIgTSZopoFEjJDNcsIamMyqpARqlnGUBsTUYVMUM0yxrTRGNNGY4TrYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Month = _t, sales = _t, users = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Month", type text}, {"sales", Int64.Type}}),
#"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Month]), "Month", "sales", List.Sum)
in
#"Pivoted Column"For more details, please check the pbix as attached. If it doesn't meet your requirement, kindly share you sample data to me.
https://www.dropbox.com/s/lx3zjix9gbf472i/Pivot%20multiple%20month%20columns.pbix?dl=0
Regards,
Frank
ET4
4 years agoNew Member
Hi v-frfei-msft,
Is it possible to achieve the table shown in the first image with a dataset similar to the table in the second image?