cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kelly4dm
Helper I
Helper I

Column data = table name

I would like to append two tables, but I would like to be able to differenciate which data came from which table. Is there an easy way to pull the table name into the a column named "table" and use the table name as data? 

1 ACCEPTED SOLUTION

Add table name with your value using "Add Prefix" In Query Editor Window . Then you do the merging.

 

Eg. Vale = 103, Then Add "Table1" , O/P = Table1103

 

From the DAX  

Create new Column 

Value = MID(O/P,7,5) -- 5 give how long max digit u have 

 

Then u change the column datatype as Integer .

 

 

It will work.

 

 

View solution in original post

5 REPLIES 5

@kelly4dm Not within the editor that allows you to append, but you can create custom columns on each of the tables and just insert the table name.

 

In the Query editor select "Add Custom Column" 

Name the column (ex. TableName)

set the value = "<Your Table Name>" (ex.    ="Table1")

Do that for both tables

Append the queries.

 


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

I tried that, but when I append the two tables it will only take the new column from the original table and will not add the new data from the other table for that column. 

@kelly4dm

 

You need to add the custom column in Query Editor, not under Data tab.

 

Cap111ture.PNG

Cap333ture.PNG

 

Both tables need to add this table name column, then you can append correctly.

Captu77re.PNG

 

Regards,

Add table name with your value using "Add Prefix" In Query Editor Window . Then you do the merging.

 

Eg. Vale = 103, Then Add "Table1" , O/P = Table1103

 

From the DAX  

Create new Column 

Value = MID(O/P,7,5) -- 5 give how long max digit u have 

 

Then u change the column datatype as Integer .

 

 

It will work.

 

 

View solution in original post

Add a custom column to each query before the Append with something like "=1" and "=2". The column name would be the same but when you import them, you know which row came from which original table.


---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors