Home » Power BI » Join Datasets with multiple columns conditions in Power BI

Join Datasets with multiple columns conditions in Power BI

Join tables with multiple conditions

In Power BI you can create relationship between tables but there is some limitation with Power BI relationship, like you cannot create relationship(or join two tables) with multiple columns.

But in Power Query you can join tables with multiple columns conditions, under merge queries you can perform with all joins, so lets get started-

Dataset sample as below:

Table 1: UserDetail

CustId Dept Customer City Country
1 User Annette Roulet London UK
2 User Antonio Moreno Toulouse France
3 IT Aria Cruz Mexico Mexico
4 Admin Dinesh Raturi Haridwar India

Table-2: UserAmount

ID User City Amount
1 Annette Roulet London 100
2 Annette Roulet Mexico 200
3 Antonio Moreno Toulouse 200
4 Bernardo Batista Mexico 400
5 Dinesh Raturi Haridwar 100

Now follow these steps

Step-1: Click on Transform data

Transform Data

Transform Data

Step-2: Power Query Editor window will be open, now under Home tab > Click on Merge Queries as new.

Merge Queries as new: Will return the join output as a new dataset.

Merge Queries

Merge Queries

Step-3: Now, we will join two tables with multiple columns conditions, you can select multiple columns to using Ctrl + Click.

Main steps:-

  • Choose UserDetail table from first dropdown, and select Customer & City column to using Ctrl + Click.
  • Choose UserAmount table from second dropdown, and select User & City column to using Ctrl + Click.
  • In Join kind select Inner Join.
  • Click on OK.

Make sure you followed the same sequence of column selection for both tables, in other words if you want to join tables with condition like-

UserDetail(customer) with UserAmount(User) & UserDetail(City) with UserAmount(City), then column selection sequence will be same like, if you select Customer then City for first table then for second table you have to select User first then City.

Because based on selection sequence Power Query will create the join condition and return the data.

Inner Join with Multiple condition

Inner Join with Multiple condition

Step-4: New dataset has been created, now click on expand icon as shown in below screen shot & select column which you want to add in table, then click on OK.

Merge Queries Output

Merge Queries Output

Step-5: Now you can see the final output of Join with multiple column condition.



Refer Power BI other post: Power BI tutorials

Hope you enjoyed the post. Your valuable feedback, question, or comments about this post are always welcome or you can leave us message on our contact form , we will revert to you asap.

Leave a Reply