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

How to combine 2 tables as one?

I have tables Alpha with 10000 rows. Columns are Id, Name, SalesDesc

I have second table Beta with 10000 rows. Columns are Code, Title, Description.

 

And I would like to combine them as 200 rows.  None of column names are exact match to each others, but data should match.

 

Is Append as New functionality? I tried and selected these 2 tables. Power BI have been loading for 30min. No error, but nothing ready is coming up.

 

Should these 2 tables have exacly same column names so that they can be combined?

 

What could help? Should I create new table Omega, which includes same column names as Alpha and contain data from Beta? 

 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

In your scenario, you can use "UNION" to combine them as one.

Ypsilon = UNION(Alpha,Beta)

union.PNG

Remarks:

  1. The two tables must have the same number of columns.
  2. Columns are combined by position in their respective tables.

  3. The column names in the return table will match the column names in table_expression1.

  4. Duplicate rows are retained.

  5. The returned table has lineage where possible. For example, if the first column of each table_expression has lineage to the same base column C1 in the model, the first column in the UNION result will have lineage to C1. However, if combined columns have lineage to different base columns, or if there is an extension column, the resulting column in UNION will have no lineage.

  6. When data types differ, the resulting data type is determined based on the rules for data type coercion.

  7. The returned table will not contain columns from related tables.

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Eli_
Frequent Visitor

Hi @Anonymous 

 

I see both tables have thesame number of columns 3, but column headers are different.

To append you will need to make both tables have thesame column headers.

 

See bolow for example on when to use Append.

Table 1

 Alpha 
IdNameSalesDesc
2SmithAnalyst
4MaryManager
5JohnAgent

 

Table 2

 Beta 
CodeTitleDescription
1MikeHR
6DanCleaner
7LindaReceptionist

 

If you change all the the table headers in Table 2 to that of Table 1, and Append. You will have the result below:

 

Table 3

 AlphaBeta 
IdNameSalesDesc
1MikeHR
2SmithAnalyst
4MaryManager
5JohnAgent
6DanCleaner
7LindaReceptionist

 

 

If this does not work for you, you might be trying to do some Merge or even Group By and not append.

Provide more explanations with pictures of your sample data, to better understand what you are trying to accoplish.

- Are the values in both tables thesame?

- Why are you expecting to have 200 rows. when you have 10000 rows in both tables?

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Anonymous
Not applicable

I'm tring now to create new table Ypsilon, which has purpose to make sure that Beta data is compatible with Alpha.

So I try to get copy value from Ypsilon. I need this table likely I cannot modify Beta table because it is used in other way in model as well.

 

First question is that is it right way to create table with "New Table"

 

Second question is that why I can create Id column, but formula bar displays table name Ypsilon?

 

Third question is that which DAX formula(or other method) copy all Id(Code), Name, SalesDesc from Beta table?

 

Ypsilon.png

Icey
Community Support
Community Support

Hi @Anonymous ,

In your scenario, you can use "UNION" to combine them as one.

Ypsilon = UNION(Alpha,Beta)

union.PNG

Remarks:

  1. The two tables must have the same number of columns.
  2. Columns are combined by position in their respective tables.

  3. The column names in the return table will match the column names in table_expression1.

  4. Duplicate rows are retained.

  5. The returned table has lineage where possible. For example, if the first column of each table_expression has lineage to the same base column C1 in the model, the first column in the UNION result will have lineage to C1. However, if combined columns have lineage to different base columns, or if there is an extension column, the resulting column in UNION will have no lineage.

  6. When data types differ, the resulting data type is determined based on the rules for data type coercion.

  7. The returned table will not contain columns from related tables.

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.