Tableau makes it easy to join different tables by working out whenever it can on which fields the tables should be joined.
To start joining tables, follow these steps:
- Drag a table from the left side of the screen.
- Double-click on the table name, and a small menu will open.
- Drag the second table you wish to join.
- If Tableau has enough information, it will automatically select an inner join on all the fields found in both tables. If this is correct, you do not need to make any changes.
- If Tableau cannot find a link, it will highlight the problem with an empty Venn Diagram and a red exclamation mark, as shown in Figure 3.15:
Figure 3.15: Tableau indicating it cannot automatically join two tables
- In the cases where Tableau cannot automatically join the tables or if the default option is not the one you need, please follow the steps below:
a. Click on the join icon to open the join menu. From here, you can select the following options:
• The field on the left side table to use in the join.
• The type of join, which can be an inner join, a left outer join, a right outer join, or a full join. These kinds of join work exactly as they would in SQL.
• The field in the right-side table to use in the join.
• A calculated field can also be used in a join. To create one, click on “Create Join Calculation” and proceed to create the field you need. More information on calculated fields will come in a separate section.
In the case below shown in Figure 3.16, the join is configured so that Tableau can use the table Account with the table Contact by using the field Account ID present in both tables but labeled as Account ID (Contact) in the Contact table.
Figure 3.16: Manually defining the join in Tableau using the join menu
As you can see, the red exclamation mark has disappeared and the two tables are now joined. This process can be repeated on as many objects as necessary. Simply drag any additional table into the join area, as shown in Figure 3.17, and proceed with the steps defined above.
Figure 3.17: Multiple tables successfully joined in Tableau
To remove a table, follow these steps:
- Hover on the table name
- Click on the caret on the left side of the table name. A menu will open, as shown in Figure 3.18:
Figure 3.18: Removing a table from the join in Tableau
- Click on Remove.
The table has now been removed from the join. You can see that the number of tables in Account has changed from 2 to 1, as shown in Figure 3.19:
Figure 3.19: The join table count is decreasing after removing a table