Forum Discussion
Pulling in a third column based on ID's
I have two tables and they join on the ID column.
Table 1 has ID, FIRST NAME, LAST NAME
Table 2 has ID, ADDRESS
How do I bring the address column into Table 1. I have to do this multiple times, I'm trying to create a master table within PowerBI.
Hi nniphadk,
There are multiple ways to bring columns from one table to another, if they have a joining key. The steps below would help you to implement a merge query in query editor to and join 2 tables and bring columns together.
- Load the 2 tables in Power BI and open query editor
- Click on the source table (the one you want to use as master) and click on Merge Queries option in Home tab
- This will open the merge query window as shown above. Select the key columns on both the table that would facilitate the join
- Select the type of join (usually it's left join)
- The join is complete. Now expand the table column added. Select the columns you want to bring in your master table.
- Voila! Its done. You would have the column available in your master table. You can also join more than 2 tables using this method.
There are other solutions to this problem as well, such as creating relationships between tables and using DAX formulas to create calculated columns using RELATED function.
Or
You can also use LOOKUPVALUE DAX formula as well to bring values to the table.
Use whatever suits your requirements!
2 Replies
- Bipin-Lala
Solution Sage
Hi nniphadk,
There are multiple ways to bring columns from one table to another, if they have a joining key. The steps below would help you to implement a merge query in query editor to and join 2 tables and bring columns together.
- Load the 2 tables in Power BI and open query editor
- Click on the source table (the one you want to use as master) and click on Merge Queries option in Home tab
- This will open the merge query window as shown above. Select the key columns on both the table that would facilitate the join
- Select the type of join (usually it's left join)
- The join is complete. Now expand the table column added. Select the columns you want to bring in your master table.
- Voila! Its done. You would have the column available in your master table. You can also join more than 2 tables using this method.
There are other solutions to this problem as well, such as creating relationships between tables and using DAX formulas to create calculated columns using RELATED function.
Or
You can also use LOOKUPVALUE DAX formula as well to bring values to the table.
Use whatever suits your requirements!
- ryan_mayu
Super User
pls provide some sample data and expected output