Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Denesting flat table with ID field

I have a sample dataset that mirrors a situation I have from my postgres database. The dev already flattened the JSON and now I want to transpose back into its respective columns. I have some sample ...
  • MarcelBeug's avatar
    8 years ago

    Something like this (I also adjusted your Source step):

     

    let
        Source = Table.FromRecords( 
                 {
                     [id =123, names ="field_num",      values = "17"] , 
                     [id =123, names ="field_name",     values = "tagging"],
                     [id =123, names ="another_metric", values = "sales"],
                     [id =123, names ="custom_valu",    values = "CC"]
                 }),
        #"Pivoted Column" = Table.Pivot(Source, List.Distinct(Source[names]), "names", "values")
    in
        #"Pivoted Column"