Forum Discussion
tking
6 years agoRegular Visitor
Transforming one large column into multiple distinct columns based on a third column
Hey I've ran into a situation where I need to pivot a grouping column and the relevant data should be grouped based on that. I'm trying to group display value by row number but it's not working as I...
ImkeF
Community Champion
6 years agoHi tking
please paste this code into the advanced editor and follow the steps:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs7PMQzKLzdU0lEyVIrVAQsYoQsYowuAtBgBBYyQtaAIGCMEYgE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Column2"}, {{"Row", each _[Column1]}}),
Custom1 = Table.FromRows( #"Grouped Rows"[Row] )
in
Custom1
- tking6 years agoRegular Visitor
hey ImkeF
I tried your approach and it worked fine but the problem is that I have null values for some of my cells. Is there a way to keep them without writing more custom M code? I was hoping for an easier non code solution to the problem because it seems so trivial when you think about it