Extra column that can filter table name from Appended multiple tables

alipezu

Board Regular
Joined
Oct 18, 2016
Messages
51
Hi All,
I have multiple tables Table A and Table B and I have appended those.
Now the problem is that Appended query doesn't have A column that shows me a table name??
So I would like to have a column (Table Name) that can show me a table name. so that I can filter it later.
Please help.
Thanks.

[TABLE="width: 500"]
<tbody>[TR]
[TD]Table Name[/TD]
[TD]Employee name[/TD]
[TD]Employee ID[/TD]
[/TR]
[TR]
[TD]Table A[/TD]
[TD]David[/TD]
[TD]10001[/TD]
[/TR]
[TR]
[TD]Table B[/TD]
[TD]Richard[/TD]
[TD]10022[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Power Query has a function for exact this situation: Table.FromPartitions.

Code for your situation:

Code:
= Table.FromPartitions("Table Name",{{"TableA", TableA},{"TableB",TableB}}, type text)

The first parameter is the name of your additional column.
The second parameter is a list of lists, each inner list is a pair consisting of the table name and the table itself.
The third argument is optional for the type of your new column (default any, in the code above: type text).
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,027
Members
452,374
Latest member
keccles

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