Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Excel Power Query – Appending Tables With Fields From Main Table Only

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading