cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vitexo87 Member
Member

Joining contents of two tables into one new table

I have the Table A:

Entidade_ID
LocOrgTrab_CD
Empresa_ID
Orgao_CD
Ano_CD
SiglaOrgaoF

 

Table B:
LocOrgTrab_ID
LocOrgTrab
LocOrgTrab_CD
LocOrgTrab_DS
LocOrgTrab_SL
Entidade_ID

 

As can be noted in both tables I have the LocOrgTrab_CD and Entidade_ID fields, and through them I need to somehow relate these two tables to setornar into one, in the end I wanted to have a table with the following fields:

 

Table C:

Entidade_ID
LocOrgTrab_CD
Empresa_ID
Orgao_CD
Ano_CD
SiglaOrgaoF
LocOrgTrab_ID
LocOrgTrab
LocOrgTrab_DS
LocOrgTrab_SL

 

I can do it without problem using the Add Query feature, however the table information with B table are not matching, for example where has values ​​of other fields in LocOrgTrab_ID field is null, and when I have the field values ​​LocOrgTrab_ID values the other fields are zero, and the LocOrgTrab_ID field is the table key to the future will relate to the fact but trying to make this relationship with fact not the right due to the aforementioned problem.

 

Ja I Sweetheart create the same LocOrgTrab_ID field in Table A but it is not possible, any suggestions of what I can do? there is a way of doing an INNER JOIN joining the two tables to make one and not bring information void?

If you need the data in the tables I can provide.

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator v-sihou-msft
Moderator

Re: Joining contents of two tables into one new table

@vitexo87

 

As @wonga mentioned, you can use "Merge Query" feature in Power BI Desktop. Just select columns you need to match and choose "Inner" in Join Kind. It will only join those matching rows.

 

Capture22.PNG

 

Regards,

6 REPLIES 6
wonga Established Member
Established Member

Re: Joining contents of two tables into one new table

@vitexo87

 

Have you tried using the "Merge Queries" feature in Power BI Desktop? The way that works is that you choose columns that are related to each other from each table and merge the two tables together based on those relationships.

Moderator v-sihou-msft
Moderator

Re: Joining contents of two tables into one new table

@vitexo87

 

As @wonga mentioned, you can use "Merge Query" feature in Power BI Desktop. Just select columns you need to match and choose "Inner" in Join Kind. It will only join those matching rows.

 

Capture22.PNG

 

Regards,

vitexo87 Member
Member

Re: Joining contents of two tables into one new table

@v-sihou-msft @wonga

 

I used this feature and made the relationship but that first time are experiencing some errors, the information at the end is not correct, I am investigating why but would have any tips on how to use this function?

wonga Established Member
Established Member

Re: Joining contents of two tables into one new table

@vitexo87

 

If you can provide some context as to what exactly is going wrong, it would be easier to troubleshoot. Please provide examples of what you started out with, what join you used and the resulting table of that join. Also provide, what output you expected. This way we can try and replicate it on our end and see where you may have went wrong, thanks.

datavis Member
Member

Re: Joining contents of two tables into one new table

My two tables have most of the same headers but different records. When I merge queries, I get the new column at the far right of the table. The data does not merge whether I choose expand or aggregate. How do I get it to merge?

 

Highlighted
RJD515 Frequent Visitor
Frequent Visitor

Re: Joining contents of two tables into one new table

Hi Guys,

I am trying to MERGE 2 table for my project and it keeps failing and I need some help.

 

Both the tables have 2 common column but with different names (SR_Number and SR_Num). Is that an issue?