Forum Discussion

TobiasHolm's avatar
TobiasHolm
Frequent Visitor
3 years ago
Solved

Split a column as rows into a new table

Hi   We have a large table with a lot of columns. One of them contains the number of incoming, resolved and waiting tasks in that month. Another column contains the information, as to whether it is...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi TobiasHolm 

    You can put the following code to Adcanced Editor

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8krMU9JR8sxLzs/NzEsHMg2VYnVgwkGpxfk5ZakpQKYRknB4YmYJRLExWNQtNQnVDBMkYSQzTJGEEWaYKcXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Month = _t, Designation = _t, Tasks = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Month", type text}, {"Designation", type text}, {"Tasks", Int64.Type}}),
        #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Designation]), "Designation", "Tasks", List.Sum)
    in
        #"Pivoted Column"

    Output

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.