Looking to join data sources in Tableau, but unsure where to start?
You’re in the right place.
The process of joining data sources in Tableau is an important step that allows you to blend and analyze data from different tables, spreadsheets, and databases.
To join data sources in Tableau, you must drag and drop the relevant fields from two data sources onto the canvas. Tableau will automatically create a join clause based on common field names in the two datasets. You can either join or blend your dataset depending on your data sources and analytical needs.
In this article, we’ll go through the details of each step to give you a clear understanding of how to go about joining data sources.
Let’s dive in!
4 Steps to Join Data Sources in Tableau
In this section, we will cover 4 steps for joining data sources in Tableau.
For demonstration purposes, we will use two datasets, one with information on customers and the other with information on orders.
The customers dataset looks like the following:
The orders dataset looks like the following:
The steps to join the data sources are given below:
Step 1: Connect to Data Sources
On the start page, under “Connect,” choose the type of data source you want to connect to.
Follow the prompts to connect to your first data source.
Once connected, you will see the data source page.
Step 2: Add Additional Data Sources
To add more data sources, click on “Add” next to “Connections” on the data source page.
Connect to your additional data sources by following the same steps as above.
Your data source page will now have two datasets.
Step 3: Drag and Drop to Join
From the left pane, drag a table and drop it into the join area (the main area in the data source page).
Click on the data source in the data source pane and select Open.
Drag another table you want to join with the first table and drop it next to the first table in the join area.
Tableau will automatically suggest a join based on common fields. You will see a “Venn diagram” icon representing the join.
Step 4: Configure the Join
Click on the Venn diagram icon to configure the join.
Select the type of join you need (Inner, Left, Right, or Full Outer) based on how you want your data to be combined.
Choose the fields from both tables that you want to use for the join. These are usually fields with the same or related data (like Customer ID in both tables).
Now you have a combined dataset with data from the two tables.
What Are The Types of Joins in Tableau
In Tableau, you can perform various types of joins to combine data from multiple tables based on common fields.
The four primary types of joins are:
Full Outer Join
1. What is Inner Join
An Inner Join returns only the rows where there is a match in both tables being joined.
For example, if you join the Customers and Orders datasets on CustomerID, the inner join will return only the rows where a CustomerID exists in both the Customers and Orders datasets.
2. What is Left Join
A Left Join returns all the rows from the left table and the matched rows from the right table. If there is no match, the result is NULL on the right side.
For example, if you perform a left join of Customers (left) and Orders (right) on CustomerID, you’ll get all the customers, and if any customers have orders, those details will be included.
3. What is Right Join
A Right Join returns all the rows from the right table and the matched rows from the left table. If there is no match, the result is NULL on the left side.
For example, if you perform a right join of Customers (left) and Orders (right) on CustomerID, you’ll get all orders, and if any orders have customer details in the Customers table, those details will be included.
4. What is Full Outer Join in Tableau
A Full Outer Join returns all rows when there is a match in either the left or right table.
This means it returns all the rows from the left table and all the rows from the right table and puts NULL in where there is no match.
For example, if you perform a full outer join of Customers and Orders on CustomerID, you will get all records from both tables. Where there is no match, NULLs will be placed.
Looking for some demo data to practice your data analytics skills? Larn how to create demo data with ChatGPT by watching the following video:
Tableau’s ability to connect to and join data from multiple sources is a powerful feature that empowers users to create more comprehensive and insightful visualizations.
By understanding the various join types and data blending techniques, you can ensure that your analyses are based on a solid foundation of integrated data.
Furthermore, Data integration is often a critical aspect of successful analytics, and Tableau’s intuitive interface makes it easier for analysts and business users to combine data from different sources and unlock new insights.
So, as you navigate through your data integration journey, remember to take advantage of the resources and communities available to you.
Frequently Asked Questions
In this section, you will find some frequently asked questions you may have when joining datasets in Tableau.
What are the different join types available in Tableau?
Tableau offers several join types, including:
Inner join: Includes only the matching records from both tables.
Left join: Includes all records from the primary (left) table and matching records from the secondary (right) table.
Right join: Includes all records from the secondary (right) table and matching records from the primary (left) table.
Full outer join: Includes all records from both tables, matching records where available and NULL values where there is no match.
Cross join: Combines every record from the primary table with every record from the secondary table, creating a Cartesian product.
How to join multiple tables in Tableau?
To join multiple tables in Tableau, follow these steps:
Drag and drop the necessary fields from the primary table to the worksheet.
Tableau will prompt you to add related data tables if necessary. Click “Add” to add the related tables.
Tableau will automatically create the appropriate joins based on the common fields between the tables.
What is the difference between blending and joining in Tableau?
Blending and joining are both methods of combining data from multiple tables in Tableau, but they work differently.
Joining: Combines data at the database level by merging rows from two or more tables based on a common field. Joins are typically used when working with a single data source.
Blending: Combines data at the visualization level by aggregating measures from different data sources. Blending does not require a direct relationship between the data sources and can be used when working with multiple data sources.
How to join data sources using a custom SQL query in Tableau?
To join data sources using a custom SQL query in Tableau, follow these steps:
Connect to your primary data source in Tableau.
Go to the Data menu and select “New Data Source.”
Choose “Custom SQL” as the connection type.
Enter your custom SQL query that includes the necessary joins.
Click “OK” to create the data source using the custom SQL query.
Drag and drop the required fields from the new data source onto the worksheet.
Tableau will automatically execute the custom SQL query and display the joined data in the worksheet.
Can I join data from different databases in Tableau?
Yes, you can join data from different databases in Tableau. Tableau supports a wide range of database connections, and you can join tables from different databases as long as the databases are accessible and the appropriate drivers are installed.
To join data from different databases, follow the same steps as you would for joining data within a single database, but make sure to connect to the required databases and select the appropriate tables when creating the data source.