In the last block we saw Joins in SQL. In this blog, we will see how to do Joins in Tableau.
Joins in Tableau
Tableau uses 4 types of Joins:
Step 1: Create an Excel file by naming the file “Sample.xlsx and Create two sheets with Table 1 and Table 2.
Step 2: Launch Tableau Desktop and Connect to ‘Sample.Xlsx. Learn how to connect to excel data source
Step 3: After connecting to Excel File, we can see the two tables:
Step 4: Select and Drag the Table 1 to ‘Drag sheets here’. You can observe the below image.
Step 5: Now select and Drag the Table 2.
You can observe the below result,
Result: The table does not show any data , because the join is not assigned or is incorrect. By default, Tableau considers the Join between the Common Columns in two tables.
In above tables, we don’t have any common columns. We should provide the Join condition manually.
Step 6: We have joined both the tables using the condition.
Table 1.Student ID = Table2.ID
For Inner Join in Tableau:
By default Tableau selects the Inner Join, when joining two or more tables. Inner Join returns only matching rows from both tables.
Step 7: To change the type of join from Inner Join to left Join, Click on the highlighted part to select the Left Join in the below image.
Step 8: For Left Join in Tableau
Left Join returns all the rows from left table and matching rows from the right table, remaining unmatched rows from right table are shown as Null values.
Step 9: For Right Join in Tableau
Repeat the step 7 to select the Right Join.
Right Join returns all the rows from Right table and matching rows from the Left table, remaining unmatched rows from left table are shown as Null values.
Step 10: For Full Outer Join in Tableau
Repeat the step 7 to select the Right Join.
Full Outer Join is a Union of both left and right outer join.