Joins in Tableau plays 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 present 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 Tableau report for Country wise sales, Country information will be in Geography or territory table, and Sales will be in the Sales table. In these situations, we can use Tableau Joins to join Geography and Sales tables.
Tableau Joins Example
The following screenshot will show the available Joins in Tableau to join data
- Inner Join: It returns the records (or rows) present in both tables If there is at least one match between columns. Please refer SQL Inner Join article to understand it better
- Left Join: This Tableau Join returns all the records (or rows) present in the Left table and matching rows from the right table. Please refer SQL Left Join article.
- Right Join: It returns all the records (or rows) present in the Right table and matching rows from the Left table. Please refer SQL Right Join article to understand it better
- Full Outer Join: This Tableau Join returns all the records (or rows) present in both the Left table and the right table. All the Unmatched rows will fill with NULL Values. Please refer SQL Full Join article to know it better
How to Join Data in Tableau ?
In this article, we will show you how to Join Data in Tableau with a live example. For this, we are going to use the data present in SQL Server so, Please refer to Connecting Tableau to SQL Server to understand the connection settings.
The below screenshot will show you the data present in Employee table
The below screenshot shows the data present in the Department table
To describe how to join data in Tableau, we need at least two tables. First, Drag and drop the first table or left the table to the field region. In this example, we are using our Employee table as a left table
Next, Drag and drop the second table or right table to the field region. When you dragged the Department table, a pop-up window will be opened to select the Join type and Joining key, as shown below.
Tableau Inner Join Example
This example shows how to join data in tableau using the Inner Join.
As we all know, Dept ID in Employee table and Id in the Department table are the key columns we are going to use for Joining Employee and Department table. First, Select the Dept ID column from the Employee table as shown below
Next, Select the Id column from department table as shown below
We created a simple table report with Occupation, Last name, Department name, First name on Rows and Sales Amount, and Yearly income on columns. Let us see the Inner join report preview.
From the below screenshot, you can observe that Inner Join 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 in Tableau using Left Join. For this, let us change the Join type from Inner Join to Left Join
Let us see the Left Join report preview. From the below screenshot, you understand that Left Join is producing 14 Rows. It includes all the records from the Employee table and matching records from the Department table. Remember, four non-matching records from Department table will be displayed as Nulls
Tableau Right Join Example
In this Right Join data in Tableau example, we show you how to join data in tableau using the Right Join. Let us change the Join type from Left Join to Right Join
Let’s see the Right Join report preview. From the below image, you can observe that the Right Join is producing 12 Rows. Output includes all records from the Department table and matching records from the Employee table. Remember, two non-matching records from the Employee table will display as Nulls.
Tableau Full Outer Join Example
This example explains to you how to join data in Tableau using Full outer Join or Full Join. For this, let us change the Join type from Right Join to Full Outer Join.
Let us see the Tableau Full Outer Join report preview. From the following screenshot, you can see that Full Outer Join is producing 16 Rows. It includes 2 Non-matching records from the Employee table and 4 non-matching records from the Department table.
NOTE: Using this Join in Tableau method, you can join more than two tables. Please be careful with complex joins, and it will be difficult to understand the data.