Hey Ninjas! When the data is present in different tables, we join the tables along with a key column that is the same in the tables, making it easier to analyse the data. Tableau is a data visualisation tool used to create stunning visuals, and it also helps us do various operations on the data.
This blog will teach us about joins in Tableau and its uses and types. We will also look at example data and try on various joins.
Tableau
It is a data visualisation tool that is very helpful in creating interactive visuals and analysing complex data with its drag-and-drop feature. Tableau is beginner friendly and easy to learn.
Various kinds of data, such as Excel, JSON, PDF and statistical files, can be connected to Tableau. There are huge customisation options available in Tableau, which helps create different and exciting dashboards. It is also available on platforms such as Cloud servers, Web and Desktops.
Uses of Join in Tableau
Let us look at some of the uses of join in Tableau to understand joins and Tableau in a better way.
We can analyse different tables simultaneously and have a better look at the data.
While working with complex data with different tables, it is important to use join because it helps us make better decisions and improve overall performance.
We can select only the data we need that is present in different tables using join.
Joins are also used in Tableau to create some complex visualisations, such as dashboards and heat maps.
Types of Join
While working in Tableau, there are four types of joins that we need to consider depending upon the types of analysis we need to do.
For example, if we see all the customers that have placed an order, we will use Inner join, and if we want to see all the customers even if they have not placed an order, we will use Left join.
Inner Join
Left Join
Full Outer Join
Right Join
Inner Join in Tableau
In this type of join, the common data in both tables are selected. It can also be considered as an intersection of both tables. The result of the Inner join from both tables includes the rows that are the same in both tables. Inner join also requires a common column to set up a relationship between the tables.
For example, when we have two tables of Employees and Projects, the Inner join can be used to select the matching employee and project data from both tables.
Left Join in Tableau
It is also known as the Left outer join. It selects the common data from both the tables and all the data from the left table. This type of join is used when we need all the data from the left table and only the common data from the right table.
For example, when we have two tables of Employees and Projects, the Left join can be used to select all the employees, including the ones who have not been allotted to any project.
Full Outer Join in Tableau
In Full Outer join, all the data from both tables are selected whether they have anything in common or not. Values that are present in one table are set to NULL during the Full Outer join operation.
It is used when we need and analyse all the data from both tables simultaneously. It is mainly used in Data merging and warehousing. For example, when we have two tables of Employees and Projects, the Full Outer join can be used to select all the employees and the projects, including the ones without matching project or employee data respectively.
Right Join in Tableau
It is also known as the Right Outer join. It selects the shared data from both the tables and all the data from the right table. It is used when we need all the data from the right table but only the common data from the left table.
For example, when we have two tables of Employees and Project, the Right join can be used to select all the projects, including those that haven't been allotted to an employee.
How to create a Join in Tableau?
Let us look at the steps to create a join in Tableau.
Step 1: Firstly, we connect Tableau to the dataset on which we will perform the join operations. We can connect datasets from various sources such as Excel, CSV and SQL servers.
Step 2: Now, we will use Tableau's drag-and-drop feature and add the tables on which we will perform the join operations to the workspace in Tableau.
Step 3: According to the types of our analysis, we will define a relationship between the tables and use the knowledge of the types of join in Tableau that we learned above to know which type of join will be used.
Step 4: Now, a join box will appear on the screen. We will choose the types of join based on our needs and click on Apply to complete the join operation.
We have looked at all the steps to create a join in Tableau. Don't worry if you haven't understood the steps clearly. We will take an example for you to know how to create a join in Tableau.
Example:
We have Excel data of a company. It has two tables, Employees and Departments. We will try to use all the join operations on this data.
Now, let us apply all the steps to see how different kinds of join operations can be used on this data.
Step 1: We have data present in Excel form. Let us upload this Excel file on Tableau.
When we connect the file, it should look like the image below.
We have now successfully connected the data to Tableau. Now let us add the first table from this data.
Step 2: Double Click on the first table to open the Join Canvas. It activates the join operation.
Step 3: We will drag and drop the second table.
And it should look like this.
Step 4: Now let us try on different types of join and see the results.
Inner Join
We will select the common columns from both the tables for Inner join.
Explanation
Both tables have a common column named DepartmentID. We have applied the Inner join based on DeparmentID. So in the output, we get only the rows whose DepartmentID matches in both tables.
Left Join
We will just click on the Left icon present in the Join box.
Explanation
In the output, we get all the data from the employees table and the common data from the Department table based on the DepartmentID column.
Full Outer Join
Now, let us try Full Outer join on the table based on the common column DepartmentID and analyse the output.
Explanation
The output contains all the data from both tables. Null values in the result set represent the data that is not present in either of the tables.
Right Join
Lastly, we will have a look at Right Join on this data and try to analyse the data based on the result we get.
Explanation
As we can see from the output, we get all the data from the right table and only the common data on the left table based on the common column DepartmentID. Null values in the result set represent the data that is not present in either of the tables.
Frequently Asked Questions
What is Tableau?
Tableau is a data visualisation tool used to create stunning visuals, and it also helps us do various operations on the data.
What are the different kinds of join operations that Tableau supports?
There are four types of joins in Tableau, including Inner join, Left join, Full Outer join and Right join.
Is it possible to join more than two tables in Tableau?
Yes, Tableau has a feature that helps to join multiple tables.
How does an Inner join differ from a Full outer join in Tableau?
Inner join only selects the common data from the tables, but Full outer join selects all the data from the tables.
How are duplicate records managed during join operation in Tableau?
Tableau has a feature called remove duplicates which removes the duplicate records before or after joining the tables.
Conclusion
This article discusses the topic of joins in Tableau. In this blog, we have discussed joins in Tableau, their uses, types and how to create a join in Tableau. We hope this blog has helped you enhance your knowledge of joins in Tableau. If you want to learn more, then check out our articles.
But suppose you have just started your learning process and are looking for questions from tech giants like Amazon, Microsoft, Uber, etc. In that case, you must look at the problems, interview experiences, and interview bundles for placement preparations.
However, you may consider our paid courses to give your career an edge over others!