Power Query to combine multiple tables of unequal number of columns

ProudLiberal

New Member
Joined
Jan 6, 2020
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
I'm looking to combine 52 tables (weekly scrap reports from our ERP software) using PowerQuery. The column headers (see attached sample) are the scrap codes recorded during the week being reported. Therefore the number of columns in each table varies with what issues were found. I also have a summary table (with one dummy record) that has all available scrap code columns.
PowerQuery question.png


My approach was to use the summary table as the main starting point and merge the other 52 tables into that one. I've tried both Merge and Append without success.

Using Merge:
1) software wants me to "Select the same number of columns from both visible tables to continue", not practical with over 300 scrap codes in the master table (yes, that's way too many codes, but that's what's in the system)
2) this process only merges two tables at a time (I've got 52)

Using Append:
1) this process will merge multiple tables but only the first four columns

I downloaded PowerQuery today and don't have any experience using it. Any advice would be highly welcomed.

NOTICE: cross-posted on MSOfficeForums and ElsmarQualityforum
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Post a link to the shared, representative example excel file with reflected structure and data type. Use OneDrive, GoogleDrive or any similar.
 
Upvote 0
My first thought is to import your
summary table (with one dummy record)
and then append all your report files to that table...all the columns should align automatically.

But, could you elaborate on:
I'm looking to combine 52 tables
with respect to the file types please? Also, could you describe the process by which you receive the files please?
 
Upvote 0
I would look at un-pivotting each table, then appending to combine them all, then re-pivot the data. The brute strength approach is to work with 52 queries. The neat way to accomplish it is by using a function, however that depends on your level of experience using Power Query and to a certain extent where the sources tables are stored.
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,211
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top