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
Henry1943
Frequent Visitor

How to combine two table into one

I want to combine the two table as below:

Table 1

Product nameversiondateQuantity1Quantity2
H12317/7/20173 
H12327/8/20171 
H1241 1 
H12517/11/201733
H12617/12/20172 
H1271 1 
H12817/15/201711

 

Table 2

Product nameversiondateQuantity1Quantity2
H12317/7/201733
H1232 11
H12417/9/201711
H1251 33
H1261 22
H12717/14/201711
H12817/15/201711

 

I want to get the table after combine as below

Product nameversiondateQuantity1Quantity2
H12317/7/201733
H12327/8/201711
H12417/9/201711
H12517/11/201733
H12617/12/201722
H12717/14/201711
H12817/15/201711

 

 

How could I get that?

 

1 ACCEPTED SOLUTION
v-huizhn-msft
Employee
Employee

Hi @Henry1943,

1. I create a unique calculated column using the formulas. And create relationship between the two tables.

Column = Table1[Product name]&Table1[version]
Column = Table2[Product name]&Table2[version]


2. In table1, create calculated column using the formulas.

New Date = IF(ISBLANK(Table1[date]),RELATED(Table2[date]),Table1[date])
New Quantity2 = IF(ISBLANK(Table1[Quantity2]),RELATED(Table2[Quantity2]),Table1[Quantity2])


3. Create a new table by clicking "New Table" under Modeling on Home page.

Result = SELECTCOLUMNS(Table1,"Product name",Table1[Product name],"version",Table1[version],"date",Table1[New Date],"Quantity1",Table1[Quantity1],"Quantity2",Table1[New Quantity2])

Please see the expected result.

1.PNG

Please download the attached file to test.

Best Regards,
Angelia

View solution in original post

1 REPLY 1
v-huizhn-msft
Employee
Employee

Hi @Henry1943,

1. I create a unique calculated column using the formulas. And create relationship between the two tables.

Column = Table1[Product name]&Table1[version]
Column = Table2[Product name]&Table2[version]


2. In table1, create calculated column using the formulas.

New Date = IF(ISBLANK(Table1[date]),RELATED(Table2[date]),Table1[date])
New Quantity2 = IF(ISBLANK(Table1[Quantity2]),RELATED(Table2[Quantity2]),Table1[Quantity2])


3. Create a new table by clicking "New Table" under Modeling on Home page.

Result = SELECTCOLUMNS(Table1,"Product name",Table1[Product name],"version",Table1[version],"date",Table1[New Date],"Quantity1",Table1[Quantity1],"Quantity2",Table1[New Quantity2])

Please see the expected result.

1.PNG

Please download the attached file to test.

Best Regards,
Angelia

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.