Power Query to combine multiple tables of unequal number of columns

ProudLiberal

New Member
Joined
Jan 6, 2020
Messages
2
Office Version
2019
Platform
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
 

ProudLiberal

New Member
Joined
Jan 6, 2020
Messages
2
Office Version
2019
Platform
Windows
I have PowerQuery but don't know how to accomplish the tasks I outlined.
 

sandy666

Well-known Member
Joined
Oct 24, 2015
Messages
3,739
Post a link to the shared, representative example excel file with reflected structure and data type. Use OneDrive, GoogleDrive or any similar.
 

bkjohn2016

New Member
Joined
Sep 9, 2016
Messages
38
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?
 

peter789

Board Regular
Joined
Nov 20, 2016
Messages
110
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.
 

Forum statistics

Threads
1,081,636
Messages
5,360,162
Members
400,574
Latest member
Mysterr42

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top