Forum Discussion
fg5
3 years agoRegular Visitor
Rows with different schema
I have some timetable data for classes that is formatted in such a way that rows have different schema. The first few rows define the column header for each different schema, one for CLASS, one for ...
wdx223_Daniel
Community Champion
3 years agolet
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcvZxDA5WUNJR8nP0dQVSIa5BvkAq0tUxSClWJ1opxBMsHBziGBQCpF39XICkAlgKrBXI800syUjNTSzJTC5WMAQZASKMDIyMcaoywlAFtcbQxMrAAESbQmgFFEkzqKQ5siTMfNe89JzM4gyQyUZwk2MB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t]),
Custom1 = Table.Combine(Table.Group(Table.Skip(Source,2),"Column1",{"n",each if Table.RowCount(_)=1 then _ else Table.FromColumns(List.Zip({Record.ToList(_{0})})&List.Range(Table.ToColumns(Table.Skip(_)),1,2))},0,(x,y)=>Byte.From(y="CLASS"))[n])
in
Custom1