Joins in Tableau
Suppose, our client is in the healthcare domain and using SQL Server as their database. In SQL Server, there may be many Tableau-like Claims Tables, Rejected Claims Table, Customer Table, etc. Now, the client wants to know the customer-wise claims and the customer-wise rejected claims table using the Joins. Join is a query that combines the data from two or more tables by making use of the Join condition.
We can join a maximum of 32 tables; it is not possible to combine more than 32 tables.
In Tableau, Joins can be performed in two ways:
- By making use of common columns
- By making use of common data types
If we create Joins on the fields, in Tableau, all the table names are suffixed with $. While performing Joins on multiple tables, always go with the less amount of data tables, so that we can improve the performance.
In Tableau, Joins are divided into two types:
Equi Join
In the Join condition, if we are using equality (‘=’) operator, then such a kind of join is called Equi Join. Equi Join is further divided into three types:
- Inner Join: Inner Join will load the only matching records from both tables. Below is the Inner Join condition:
Tableaa.id = Tableb.id
Outer Join: Outer Join is further divided into three types:
Left Outer Join: Displays the complete data from the left table + matching records from the right
Condition:
tablea.id(+)
Right Outer Join: Displays the complete data from the right table + matching records from the left
Condition:
tablea.id(+)=tableb.id
Full Outer Join: Loads the complete data from the left table and the right table
Condition:
Table A full outer join Table B ON tablea.id= tableb.id
Self-join: If we are performing Join to a table with itself such a kind of Join is called a Self-join.
Non-equi Join
In the Join condition, if we are using operators apart from the equality (‘=’) operator (such as, <, >, <=, >=, and =!), then such a kind of Join is called Non-equi Join.
Data Blending in Tableau
Consider the same client. Suppose, they are operating their services in Asia, Europe, NA, and so on, and they are maintaining Asia data in SQL, Europe data in SQL Server, and NA data in MySQL.
Now, our client wants to analyze their business across the world in a single worksheet. In this case, we can’t perform a Join. Here, we have to make use of the data blending concept.
Normally, in Tableau, we can perform the analysis on a single data server. If we want to perform the analysis of data from multiple data sources in a single sheet, then we have to make use of this new concept called data blending.
Data blending mixes the data from different data sources and allows users to perform the analysis in a single sheet. ‘Blending’ means ‘mixing’ and when we are mixing the data sources, then it is called data blending.
Rules to Perform Data Blending
In order to perform data blending, there are a few rules:
- If we are performing data blending on two data sources, these two data sources should have at least one common dimension.
- In that common dimension, at least one value should be matching.
In Tableau, we can perform data blending in two ways.
- Automatic way: Here, Tableau automatically defines the relationship between the two data sources based on the common dimensions and based on the matching values, and the relationship is indicated in orange.
- Custom or Manual way: </spa