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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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
Zubair_Muhammad
Community Champion
Community Champion

Hi @Anonymous 

 

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()))

Regards
Zubair

Please try my custom visuals

View solution in original post

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

Hi @Anonymous 

 

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()))

Regards
Zubair

Please try my custom visuals
Anonymous
Not applicable

@Zubair_Muhammad 

 

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

@Anonymous 

 

Union function just requires same number of columns

 

Columns are combined by position in their respective tables.

 

Same Names are not necessary


Regards
Zubair

Please try my custom visuals
Anonymous
Not applicable

@Zubair_Muhammad 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.