Home > Enterprise >  Excel Power Query - Appending Tables With Fields From Main Table Only
Excel Power Query - Appending Tables With Fields From Main Table Only

Time:12-12

Appending Tables in Power Query from same workbook

I've been trying to append two tables and to keep only the fields from the main table (take out the secondary fields that do not exist in the main table) by appending queries within the same workbook. Desired Result.

The only approach I can think of is appending queries using sources outside of the Excel workbook and utilizing a folder to combine files from (use main table as a sample file) and then append any additional queries to that.Alternative Solution/Cumbersome and requires additional files

However, I need to append queries internally from the same workbook without the need of saving separate files/workbooks in a folder.

CodePudding user response:

Try

=Table.Combine({MainTable, Table.RemoveColumns(SecondaryTable,List.Difference(Table.ColumnNames(SecondaryTable),Table.ColumnNames(MainTable)))})

like in

let Source = Excel.CurrentWorkbook(){[Name="MainTableSource"]}[Content],
z=Table.Combine({Source, Table.RemoveColumns(SecondaryTable,List.Difference(Table.ColumnNames(SecondaryTable),Table.ColumnNames(Source)))})
in z
  • Related