none
Combining multiple columns in a new table RRS feed

  • General discussion

  • I have two tables with the same format each with a certain number of columns containing numerical values. I want to combine the two column into one where each column of interest are summed with each other. I can't figure our how to do that,
    Monday, December 16, 2019 9:22 PM

All replies

  • I want to combine the two column (tables, no?) into one where each column of interest are summed with each other

    Hi

    Assuming I understood, one way:

    let
        Source = Table.Combine({Table1,Table2}),
        Unpivot = Table.UnpivotOtherColumns(Source, {}, "Attribute", "Value"),
        NewTable = Table.Pivot(Unpivot, List.Distinct(Unpivot[Attribute]), "Attribute", "Value", List.Sum)
    in
        NewTable

    If this isn't what you want please post a subset of Table1, Table2 and the expected result. Otherwise if this solves your problem please Mark as answer (can help others) - Thanks

    Monday, December 16, 2019 10:25 PM