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 join two columns from two tables into two columns in another table

Hi, I have two columns in two different tables.

 

I should create a calculated table that unites the first column of the two tables into one column in the calculated table and then joins the second column of the two tables into a second column in the computed table.

 

I tried to use the UNION command, but I was able to do only one column.

 

The command I created now generated the "Conta" column.

 

= 
DISTINCT(
      UNION(
           SELECTCOLUMNS(Orcamento;"Conta";Orcamento[NROCONTACONTABIL]);
           SELECTCOLUMNS(Realizado;  "Conta";Realizado[NroContaContabil])
      )
)

But now I need to join another column, with descriptions related to the generated numbers.

 

These descriptions are in different tables:

Realizado[DescrContaContabil]
Orcamento[descrconta]
1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Anonymous

you can add the second columns from two tables to the formula you created.

I make a test by the formula below and get a mew table with two column generated from two columns from two tables.

Table = DISTINCT(
      UNION(
           SELECTCOLUMNS(Orcamento,"Conta",Orcamento[NROCONTACONTABIL],"sy",Orcamento[descrconta]),
           SELECTCOLUMNS(Realizado, "Conta",Realizado[NroContaContabil],"sy",Realizado[DescrContaContabil]
      )
))

2.png

If you have any question, could you share me some detailed data and result you want.

 

Best Regards

Maggie

View solution in original post

1 REPLY 1
v-juanli-msft
Community Support
Community Support

Hi @Anonymous

you can add the second columns from two tables to the formula you created.

I make a test by the formula below and get a mew table with two column generated from two columns from two tables.

Table = DISTINCT(
      UNION(
           SELECTCOLUMNS(Orcamento,"Conta",Orcamento[NROCONTACONTABIL],"sy",Orcamento[descrconta]),
           SELECTCOLUMNS(Realizado, "Conta",Realizado[NroContaContabil],"sy",Realizado[DescrContaContabil]
      )
))

2.png

If you have any question, could you share me some detailed data and result you want.

 

Best Regards

Maggie

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.