Enough for the theory, let's create a simple Join between the Orders and People tables from Sample - Superstore. Before we start, let's see what those tables contain:
- Orders is the main table (the left one). We already used it in Chapter 3, A First Dashboard and Exploration, and it contains the profit.
- People is a table that contains only four lines and two columns. It associates a region with a person.
Our goal is to create a Data Source that allows us to look at the profit ( which exists only in the Orders table) by person (which exists only in the People table).
Open Tableau and follow these instructions:
- Connect to the Sample-Superstore Excel file in your Tableau repository (use the Connecting to data section from Chapter 3, A First Dashboard and Exploration, if you don't remember the file's location).
- In the Data Source workspace, drag and drop the Orders table.
- Drag and drop the People table next to Orders, as in the following screenshot:
- Tableau automatically creates a Join between the two tables with Region as the link, as shown in the following screenshot:
- On the preview, you can see, on the right, the two new columns from the Person table:
- The Data Source is ready. You can test it on a Worksheet and display the profit by person as we wanted.
This is a first and simple example. You can build more complex Joins by adding more tables. In the following screenshot, we also added the Returns table:
Be careful when multiplying the Joins; it has an impact on performance.
After Joins, the next interesting feature is Unions.