How to Join Data in Tableau?

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 the Geography or territory table, and Sales will be in the Sales table. We can use Tableau Joins to connect Geography and Sales table data in these situations.

Tableau Joins Example

The following screenshot will show the available Joins in Tableau to connect data.

how to join data in tableau 1
  1. Inner: It returns the records (or rows) in both tables if at least one match between columns exists. Please refer to the SQL Inner article to understand it better.
  2. Left: This Tableau Join returns all the records (or rows) in the Left table and matching rows from the right data. Please refer to the SQL Left article.
  3. Right: It returns all the records (or rows) present in the Right table and matches rows from the Left one. Please refer to the SQL Right article to understand it better.
  4. 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 to the 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

Left Table 2

The data present in the Department

Right Table 3

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.

Add Two tables to establish Connection 4

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, the 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.

Choose the Common Column for Left table 5

Next, Select the Id column from the department table, as shown below.

Select Common ID Column from Right Table 6

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 screenshot below, you can observe that Inner is producing 10 Rows, which includes all the matching records from the Employee and Department table.

Tableau Inner Join Result 7

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.

Tableau Left Join data 8

Let us see the Left report preview. From the screenshot below, 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 the Department will display as Nulls.

left result 9

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.

right join data in tableau 10

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.

right join data 11

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.

tableau full outer join 12

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.

Full Outer Result 14

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.