Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
cgkas
Helper V
Helper V

How to merge tables with different number of columns?

Hello to all,

 

I have 2 tables with some headers in common (not all of them).

How can I join both tables in a single table that shows all headers between Table1 and Table2 locating the values in corresponding position and empty if there is no value like Output table below.

 

Table1:

TypeCustomerIDName.1Name.2PhoneCityState
A21Bob 123-4567AX
A13Jm987-6543FY
A30Paul 543-7890DW
A52Crst232-1550CZ

 

Table2:

TypeCustomerIDPhoneStateCountry
B482100-98KY
B993-993TP

 

Output:

TypeCustomerIDName.1Name.2PhoneCityStateCountry
A21Bob 123-4567AX 
A13Jm987-6543FY 
A30Paul 543-7890DW 
A52Crst232-1550CZ 
B48  2100-98 KY
B9  93-993 TP

 

Thanks for any help.

1 ACCEPTED SOLUTION
AnkitBI
Solution Sage
Solution Sage

Hi @cgkas 

You can directly use Append in Power Query Editor. It will provide the exact result you are looking for.

 

let
    Source = Table.Combine({Table1, Table2})
in
    Source

 

 For DAX, you will need to create Virtual tables using AddColumn, SelectColumn functions to make columns equal in both tables before using Union function.

 

Thanks
Ankit Jain
Do Mark it as solution if the response resolved your problem. Do Kudo the response if it seems good and helpful.

View solution in original post

3 REPLIES 3
AnkitBI
Solution Sage
Solution Sage

Hi @cgkas 

You can directly use Append in Power Query Editor. It will provide the exact result you are looking for.

 

let
    Source = Table.Combine({Table1, Table2})
in
    Source

 

 For DAX, you will need to create Virtual tables using AddColumn, SelectColumn functions to make columns equal in both tables before using Union function.

 

Thanks
Ankit Jain
Do Mark it as solution if the response resolved your problem. Do Kudo the response if it seems good and helpful.

Excellent @AnkitBI  I thougth it was much more complicated. 

Thanks so much.

vjnvinod
Impactful Individual
Impactful Individual

@cgkas 

workaround will be to add 2 blank coloumns with value null in your table 2 & arrange there order, so that it exactly looks like the your 1st table.

 

then you can append that

 

let me know if that helps, if yes kindly accept this as solution

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.