Hello. So I am working out of the query editor of a PowerPivot. I have two tables in the PowerPivot window, which I am editing with the query editor in the table properties tab. The tables have a different number of columns, some columns they have in common with each other, each contain unique columns. The columns they do share have identical header names. I would like to stack one table on top of the other while adding new columns to the original table.
For example:<p></p>
<table><i>TableA</i>
<th>Col1</th><th>Col2</th><th>Col3</th>
<tr><td>A</td><td>B</td><td>C</td>
</tr>
</table><p></p><table><i>TableB</i>
<th>Col1</th><th>Col2</th><th>Col4</th>
<tr><td>D</td><td>E</td><td>F</td>
</tr>
</table><p></p>
<table><i>Combined</i>
<th>Col1</th><th>Col2</th><th>Col3</th><th>Col4</th>
<tr><td>A</td><td>B</td><td>C</td><td>-</td>
</tr>
<tr><td>D</td><td>E</td><td>-</td><td>F</td>
</tr>
<tr>
</table>
<p></p>
Example Code:
SELECT tableA.col1, tableA.col2, tableA.col3, NULL AS col4
FROM [tableA$]
UNION
SELECT tableB.col1, tableB.col2, NULL AS col3, tableB.col4
FROM [tableB$];
I saw a post that used the NULL AS in order to compensate for the missing column(s) but once I add it in I get the "no columns detected" error message. In reality I'm working with dozens of sheets with columns ranging from 15 to over70, and rows ranging from 300. to 350k which is why I'm to using PowerPivot.
I imported my sheets to PowerPivot by creating a connection to worksheet. P.S. I'm new to both PowerPivot and Query Editor. Thank you for any help in advance.