Forum Discussion
Merging columns from two tables onto a third table based on criteria
I'm having a bit of trouble working all this out in my head. I have two tables that I'm bringing into Power BI (active link with both data sources). So here's basically what I'm trying to figure out how to do...
Table 1 contains an email column (among others but it's the only one that matters here), and Table 2 contains an email, job title, and age column (all 3 columns are important). I want to know if there's a way to create a 3rd Table that will compare email columns from Table 1 and Table 2, if they match, then the email, job title and age for that row from Table 2 will be brought over to Table 3.
So this is basically a way for me to see if the email from Table 1 exists in Table 2, then to import that row's data (columns) to Table 3. Anything in Table 3 tells me that their are matching emails, obviously. Is this possible?
Hi Pintobean80 ,
As the method provided by PijushRoy says, you can use the Merge query method.
You may also consider using dax to solve the problem,please refer to the following content.My Sample:
Table A:
Table B:
Based on your description, Please try code as below to create Calculated Table.
Table3 = NATURALINNERJOIN(NATURALINNERJOIN('Table1',VALUES('Table2'[Job Title])),VALUES('Table2'[Age]))Result is as below.
Best Regards,
Yulia Yan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- PijushRoyCommunity Champion
Hi Pintobean80
Marge query as new Table in Power Bi
Find steps - https://learn.microsoft.com/en-us/power-query/merge-queries-overview
If solved your requirement, please mark this answer as SOLUTION.
If this comment helps you, appreciate your KUDOS
Thanks
Pijush - v-weiyan1-msftCommunity Support
Hi Pintobean80 ,
As the method provided by PijushRoy says, you can use the Merge query method.
You may also consider using dax to solve the problem,please refer to the following content.My Sample:
Table A:
Table B:
Based on your description, Please try code as below to create Calculated Table.
Table3 = NATURALINNERJOIN(NATURALINNERJOIN('Table1',VALUES('Table2'[Job Title])),VALUES('Table2'[Age]))Result is as below.
Best Regards,
Yulia Yan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.