Joining allows us to combine two sources of data into one cohesive set of data. This enables us to:
- Analyse data from multiple sources
- Answer questions that couldn't be answered from either single data set
- Paint a more complete picture of the data we are looking at
How to join two data sets:
1) Drag one data set to the other and hover over 'join', then drop the data.
2) Create a join clause.
The join clause specifies how the two data sources should be linked together. Here, we need to match together one field from each data set - the values from these fields must measure the same thing and at least some values from each set must match exactly (it is fine for the field names themselves to be different, for example 'UK' and 'United Kingdom' or 'Order Number' and 'Order ID').
Click on Join 1, then there is the option to Add a Join Clause.
Click 'Add' and select the fields from each data set that match.
3) Specify the type of join you want to create.
There are 4 types of join:
Inner Join - Inner joins return only the values that match exactly. This is the default join on Tableau Prep.
Left Inner Join - This returns the values that match exactly, as well as all mismatched values* from the left hand data.
Right Inner Join - This returns the values that match exactly, as well as all mismatched values from the right hand data.
Full Join - This returns all values from both sets of data, but matching values are added to the same row.
*Mismatched values are values from the fields we used in the join clause that do not have a match in the other data set.
The areas inside the circles can be selected and unselected by clicking them. Here we will choose an Inner Join.
The result is a combined set of data:
The fields 'ID' and 'Student ID' can then be merged as they contain exactly the same information:
We now have a single set of data that contains information from both of the sets we started with.