cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
cfpvin Regular Visitor
Regular Visitor

Combine 2 tables with different number of columns

Is it possible to combine 2 different tables where table 1 has 5 columns and table 2 has 7 columns using DAX? 4 columns in each of the table have the same column. It should be like the table has been appended with DAX formula.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Re: Combine 2 tables with different number of columns

Hi @cfpvin 

 

For the Table with lesser columns you can use ADDColumns to addmissing columns as blank().
Then you can use a UNION function to combine the 2 tables

 

Something like this

 

CombinedTable = Union(Table1,ADDCOLUMNS(Table2,"MissingColumnName",BLANK()))
Try my new Power BI game Cross the River

View solution in original post

4 REPLIES 4
Super User III
Super User III

Re: Combine 2 tables with different number of columns

Hi @cfpvin 

 

For the Table with lesser columns you can use ADDColumns to addmissing columns as blank().
Then you can use a UNION function to combine the 2 tables

 

Something like this

 

CombinedTable = Union(Table1,ADDCOLUMNS(Table2,"MissingColumnName",BLANK()))
Try my new Power BI game Cross the River

View solution in original post

cfpvin Regular Visitor
Regular Visitor

Re: Combine 2 tables with different number of columns

@Zubair_Muhammad 

 

Should all the columns in both the tables have the same names?

Super User III
Super User III

Re: Combine 2 tables with different number of columns

@cfpvin 

 

Union function just requires same number of columns

 

Columns are combined by position in their respective tables.

 

Same Names are not necessary

Try my new Power BI game Cross the River
cfpvin Regular Visitor
Regular Visitor

Re: Combine 2 tables with different number of columns

@Zubair_Muhammad 

I was able to combine the tables but it took out the blank rows which were required.

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

January 2020 Community Highlights

January 2020 Community Highlights

Make sure you didn't miss any of the things that happened in the community in January!

Top Solution Authors