cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sonne
Helper II
Helper II

merge columns from different table into 1 table

table merge.JPG

Hello,

I dont find the formula for my problem . hopefully somebody can help me. 

i have different tables with different fields, but 3 columns are always the same . this 3 columns i want to have in a addional table ( distinct). 

 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

Try like

distinct(
union
(
selectcolumns(Table1,"UPI",Table1[UPI],"ID",Table1[ID],"Personalnumber",Table1[Personalnumber]),
selectcolumns(Table2,"UPI",Table2[UPI],"ID",Table2[ID],"Personalnumber",Table2[Personalnumber]),
selectcolumns(Table3,"UPI",Table3[UPI],"ID",Table3[ID],"Personalnumber",Table3[Personalnumber])
)
)

 

You can also use summarize in place of select columns, Small diff in syntax.

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!
!! Subscribe to my youtube Channel !!

View solution in original post

4 REPLIES 4
Sonne
Helper II
Helper II

I tried the DAX solution and it is working fantastic. Exactly what I was looking for. I had the Distinct and Union command in my mind and tried, but the selectcolumns i didn't think off. 

Thanks very much for the fast response. It saved my day . 🙂

Geradav
Responsive Resident
Responsive Resident

HI @Sonne ,

 

You can achieve that in the Power Query Editor with the tools available in the Ribbon.

You can use the Append Queries function in te Combine group of the Home tab.

Then you Choose Columns (Manage  Columns group in the Home tab) you want to keep and Remove Duplicates (Click on Remove Rows in the Reduce Rows group of the Home tab)

 

Let us know if that works for you.

 

Regards

 

David

amitchandak
Super User
Super User

Try like

distinct(
union
(
selectcolumns(Table1,"UPI",Table1[UPI],"ID",Table1[ID],"Personalnumber",Table1[Personalnumber]),
selectcolumns(Table2,"UPI",Table2[UPI],"ID",Table2[ID],"Personalnumber",Table2[Personalnumber]),
selectcolumns(Table3,"UPI",Table3[UPI],"ID",Table3[ID],"Personalnumber",Table3[Personalnumber])
)
)

 

You can also use summarize in place of select columns, Small diff in syntax.

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!
!! Subscribe to my youtube Channel !!
Geradav
Responsive Resident
Responsive Resident

@Sonne  What @amitchandak is proposing is a DAX measure. Just precision in case you are not entirely familiar.

So now you have a solution in both languages M (Power Query) and DAX.

Your choice.

Helpful resources

Announcements
May 23 2022 epsiode 5 without aka link.jpg

The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt talks about the importance of Data Modeling.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through June10th!

Power BI Dev Camp Session 22 without aka link and time 768x460.jpg

Check it Out!

Watch Session 22 Ted's Dev Camp along with past sessions!

Power BI Release May 2022 768x460.png

Check it out!

Click here to read more about the May 2022 updates!

Top Kudoed Authors