Join and Blend data in Tableau

Tableau provides both the option of blending and joining the data sources. But there are differences between blending in tableau and joining in Tableau.

Objective:
In this blog I am going mention when to use blending and joining. Also, I am going to explain how to join or blend the different data sources.

Quick Note to Joining in Tableau:
1. In tableau, joining can be done using different data from same data sources, for example different worksheets from Excel, different data tables from SQL or different tde files
2. Using joining in tableau user can create a different type of joins like inner join, right join, left join or full outer join
3. To join the different data, there must be some common field between them (called as key)

How to Join in Tableau
1. Connect to Sample-Superstore dataset: Open the Tableau Desktop and select the “Sample-Superstore” dataset

2. Go to Data source

3. Select the “People” sheet and drag-n-drop along with “Orders” sheet: After you click on the “Data Source” in 2nd step, you will see that the data of “Orders” sheet is already been selected. Now, to make the  join between the “Orders” sheet and “People” sheet, drag “People” sheet and put it along with ‘Orders” sheet (see below)
a)

Joining data in Tableau

b)

Select different types of joins
4. Change the joining type: Depending upon the requirement, user can change the joining type to either “Right Join”, “Left Join”, “Inner Join” or “Full Outer Join”. Please note by default tableau makes the “Inner Join” For more details on joins, check out W3C Schools Joins Page

5. Select the joining field (key): By default tableau automatically takes the field which is common in both the data. But, if requires user can change the field depending upon the requirements

Blending in Tableau:
1. In tableau, blending can be done using different data from different data sources, for example data from Excel worksheet can be blend with data table from SQL or tde file
2. Blending in tableau by default do left join
3. To blend the different data, there must be some common field between them (called as key)

How to Blend in Tableau
1. Connect to Sample-Superstore dataset: Open the Tableau Desktop and select the “Sample-Superstore” dataset

2. Click on “New Data Source” under “Data” option:

3. Connect to Sample-Superstore dataset: Open the Tableau Desktop and select the “World Indicators” dataset

4. Make the “Sample-Superstore” data as primary: In Tableau while doing blending between the data sources, the main data source is considered as “Primary” data source and the other data source which contains common fields considered as “Secondary” data source.
Now, to make the “Sample-Superstore” data as primary, put any field from this data source in sheet. In this example I have put the “Category” field. The “Blue” tick along with the data shows that this data is primary data source.

5. Make the “World Indicators” data as secondary:
a) Under “Data”, select the “Edit Relationships”:

b) In “Edit Relationships”, you can see by under “Automatic”, Region and Country is being shown. Tableau shows by default which are common field between two data source:

c) User can also customize the common fields between the two data sources. Under “Custom” option user can select the required fields to connect

d) Click on the link icon and enable the links: Select the “World Indicators” data and along with names of connecting fields, you can see the broken link will be shown, click on those links and enable the links. As soon as you click on them, it will become in orange color and also the data source will have orange tick showing that it is secondary data source

About the Author