Forum Discussion
WLou
6 years agoHelper I
Data Transformation pivot/unpivot?
Hi all, Below is a sample data in question I'm trying to move those Row in bold to the left hand side and repeat to match the rest of the rows I can manage the rest but really stuck at moving...
- 6 years ago
let Source = Table.FromRecords(Json.Document(Binary.Decompress(Binary.FromText("xdDLCoJAFAbgV5FZOzLHsdHcVbaRhC5uIlpYSQjTCDauondPicZLKm6i2Z3D98Oc//BAi5QDctHMCzCASZBebsxyc7kl4j3SYtwvd+ipKz81GabMqjwxqLJaU9qjJbSl1S2xetV/NdRtw1RGXPOSu8ySUy6TVGjrODvHQkbX2FV56E7TzRZTMqn1AoFfLAeKMZuBgXPZWElJW/69GGfuY5tBvZhVWCx7iwEgzQAxnOkHi5zzuiVfFqDH/vrk4ws=",BinaryEncoding.Base64),Compression.Deflate))), fx=(tbl)=> let sTbl = Table.RemoveLastN(tbl,2), p1 = sTbl[Col1]{0}, p2 = sTbl[Col2]{0}, toLists = List.Skip(Table.ToRows(sTbl)) in List.TransformMany(toLists,each {{p1,p2}},(x,y)=>y&List.RemoveLastN(x)), group = Table.Group(Source,"Col3",{"t",fx},0,(x,y)=>Byte.From(y="YES")), toTbl = #table(null,List.Combine(group[t])), chType = Table.TransformColumnTypes(toTbl,{{"Column4", Percentage.Type}}) in chTypeIf this works for you, please mark it as the solution.
Greg_Deckler
6 years agoCommunity Champion
My thought is that you data may take the cake for some of the ugliest I've ever seen. I mean, not to call your baby ugly but wow... Your saving grace may be those ---- rows.
ImkeF , edhans any magic here?
ImkeF , edhans any magic here?