Joins in Tableau play a vital role in designing reports. In real-time, we usually create reports using a database or data warehouse, and we all know that the data in the database is in normalized form. So, we can’t generate reports using a single table (mostly not, as per the business perspective).
For example, if you want to design a report for Country wise sales, Country information will be in Geography or territory table, and Sales will be in the Sales table. We can use Tableau Joins to connect Geography and Sales tables data in these situations.
Tableau Joins Example
The following screenshot will show the available Joins in Tableau to connect data.
- Inner: It returns the records (or rows) present in both tables If there is at least one match between columns. Please refer SQL Inner article to understand it better.
- Left: This Tableau Join returns all the records (or rows) in the Left table and matching rows from the right data. Please refer SQL Left article.
- Right: It returns all the records (or rows) present in the Right table and matches rows from the Left one. Please refer SQL Right article to understand it better.
- Tableau Full Outer Joins: It returns all the records (or rows) in both the Left and right tables. All the Unmatched rows will fill with NULL Values. Please refer SQL Full article to know it better.
How to Join Data in Tableau?
This Tableau article will show you how to Join Data with a live example.
For this Tableau Joins example, we will use the data present in SQL Server, so please refer to Connecting to Server to understand the connection settings.
The data present in the Employee
The data present in the Department
We need at least two tables to describe how to join data in Tableau. So, drag and drop the first or left table in the field region. In this example, we use our Employee table as a left table.
Next, Drag and drop the second or right table to the field region. For example, when you drag the Department, a pop-up window will open to select the Join type and key, as shown below.
Tableau Inner Join Example
This Tableau example shows how to join data using the Inner.
As we all know, Dept ID in the Employee table and Id in the Department table are the key columns we will use for the Joining Employee and Department table. So, first, Select the Dept ID column from the Employee as shown below.
Next, Select the Id column from the department table, as shown below.
We created a simple table report with Occupation, Last name, Department name, First name on Rows, Sales Amount, and Yearly income in columns. Let us see the Inner report preview.
From the below screenshot, you can observe that Inner is producing 10 Rows, which includes all the matching records from Employee and Department table.
Tableau Left Join Example
This example shows you how to join data using Left. For this, let us change the type from Inner to Left.
Let us see the Left report preview. From the below screenshot, you understand that Left is producing 14 Rows. It includes all the Employee records and the Department matching records. Remember, four non-matching records from Department will display as Nulls.
Right Join Example
This Tableau Right Join example shows you how to connect data using the Right. But, first, let us change the type from Left to Right.
Let’s see the Right report preview. From the below image, you can observe that the Right is producing 12 Rows. Output includes all records from the Department and matching records from the Employee table. Remember, two non-matching records from the Employee will display as Nulls.
Full Outer Join Example
This example explains how to join data in Tableau using Full Outer or Full. For this, let us change the type from Right to Full Outer.
Let us see the Tableau Full Outer Joins data report preview. From the following screenshot, you can see that Full Outer is producing 16 Rows. It includes 2 Non-matching records from the Employee and four non-matching records from the Department.
NOTE: Using this method, you can connect more than two tables. Please be careful with complex joins; it won’t be easy to understand the data.
Comments are closed.