Joining Datasets using Multiple JOIN Conditions in Power BI

Joining datasets is a norm in any ETL process specially if you are working with more than one dataset. In Power BI, joining two datasets is super easy, even it is easier than you joining two tables in T-SQL. Thanks for the powerful Power Query language you can perform joining tasks visually. However, sometimes you may get confuse the joining in Power BI because there are close similarities in UI for Joining datasets and Build relationships between datasets. However, my today post is not about How to Join two tables in Power BI. For that, you can read my article on Demystify Joins in Power BI.

In this article I'm going to explain to you how to join two datasets using multiple join conditions. I'm sure you have performed this task in SQL many times before. 


Scenario


Assume that I have two tables, Product Table and Sales Table. In my product table I have, Product ID, Product, Color and Unit Price

My Sales table contain daily sales information along with the Product and Product Color
In this Sales Table, instead of storing Product and Color columns if we can bring a ProductID column, it would be ideal in many ways. In order to do that I require to join the Sales and Product table with multiple join conditions. 

If we simulate this using basic T-SQL code, the code would be like this. 

SELECT S.* , P. ProductID
FROM Sales S
LEFT JOIN Product P ON S.Product = P.Product AND S.Color = P.Color
view raw Join Tables.sql hosted with ❤ by GitHub



In order to join these two tables in Power BI, go to Query Editor,  it will open the Power Query Editor then you can select Merge Queries to join two tables.

Select the Sales table as the first table. Product table as the second table. In order to select multiple columns to join, hold Ctrl and select the fields.

Ctrl + Select columns



Hope you learn how to join two datasets using multiple join conditions in Power BI 😃

Comments

  1. This comment has been removed by the author.

    ReplyDelete
  2. Invest with 200$ and get a returns of 5,000$ within seven business working days.
    Why wasting your precious time online looking for a loan? When there is an opportunity for you to invest with 200$ and get a returns of 5,000$ within seven business working days. Contact us now for more information if interested on how you can earn big with just little amount. This is all about investing into Crude Oil and Gas Business.

    Email: investmoneyoilgas@gmail.com

    ReplyDelete
  3. I think REST API and Power BI should actually be judiciously utilized in order to crack the most complex IT operations.

    Powerbi Read Rest

    ReplyDelete
  4. very nice and provide me informative content thanks for sharing for more information Looking for the best Business Intelligence reporting Services

    ReplyDelete
  5. Great article with very unique content.
    Thank you for sharing this awesome blog.
    Keep updating...

    Power BI Training

    ReplyDelete

Post a Comment