Preppin' Data 2024 Week 27 Part 2: More Joins in Tableau Prep Builder

This blog follows on from the previous blog titled Preppin' Data 2024 Week 27 Part 1: Joins in Tableau Prep Builder where we completed Steps 1-6 of the Preppin' Data 2024 Week 27 challenge.

Steps to be completed in Part 2:

  1. Joining the Wins data
  2. Removing the duplicate fields created from joining
  3. Inputting the Grand Tour Starts (and only keeping the Tour de France starts)
  4. Renaming fields
  5. Joining the races started to the overall data set
  6. Create a Stages Won? field
  7. Outputting the data

Let's start with joining the data!

1) Joining the Wins data

To perform a standard join, we need at least one common field in both tables of data. The table of data that we made from the first steps of this Preppin’ Data challenge (in Preppin' Data 2024 Week 27 Part 1: Joins in Tableau Prep Builder blog) has a field called Stage Number. The only field that matches this information in the Wins data table, is the Race field. However, it is not in the correct format (i.e. Race | Stage Number). We need to extract the stage number from this field to perform the join. We would also like to join the data on the year of the race which can be found in the Year field and Date field in the Wins data (year needs to be extracted from this).

  • Use the Custom Split function where the separator is ‘ | ‘. 
Custom Split to extract the Race and Stage Number as separate fields
  • Remove the old Race field and rename Race - Split 1 and Race - Split 2 fields to Race and Stage Number
  • Change the Prologue stage in Stage Number to be 0 by double clicking and manually typing 0.
Changing 'Prologue' records to be '0' by manually typing
  • Remove Stage text from the Stage Number field, using the Custom Split function (separator is ‘ ‘ and ensure to split off on the last field!)
Removing 'Stage' from the Stage Number field using a Custom Split
  • Remove the original Stage Number field and rename the new field from Stage Number - Split 1 to Stage Number Won
Overview of the tables that need to be joined
  • Convert the Date field in the Wins table to only include the year and rename Date field to Year
    • We have now got the same format for the Stage Number fields in both tables, but the Year/Date fields are different.
Extracting the year from the Date field using the Convert Dates function

This is what the tables look like now! From the challenge, we want to ‘keep all of the stages and add additional details of the stages Cavendish has won’. So, we only want to include the ‘Tour de France’ races that Cavendish participated in by filtering to keep only ‘Tour de France’.

Filtering to only include Tour de France races in the Wins table=

The tables are now in the correct format to join!

Overview of the tables to be joined that are now in the correct format
  • Join the data

Let’s quickly recap what the data is showing us!

Joined Data from previous steps (294 rows)

Data from the Stages table (detailing the stages in the years that Cavendish raced the Tour and Stage Type table (detailing the type of stages raced) have been joined to show information about the stages in the years that Cavendish raced the Tour.

Cleaned Wins data (34 rows)

Shows the Tour de France Stage Numbers that Cavendish won and in what year he won. 

We need to join these tables on Stage Number and Stage Number Won and Year.

Configuring the join in Tableau Prep (the left join keeps all records from the first table and just adds additional information to the existing rows)

2) Removing the duplicate fields created from joining

Output after removing duplicate fields from the join

3) Inputting the Grand Tour Starts (only keeping the Tour de France starts)

We need to join the Grand Tour Starts table to the new table we have just created from Step 2. 

Overview of the tables to be joined
  • Filter Grand tour field in Grand Tour Starts data to only include 'Tour de France'
  • Remove Mountains, Youth, #, Grand tour and Best stage result fields

4) Renaming fields

    • GC to 'General Classification Finishing Position'
    • Points to 'Points Finishing Position'

5) Joining the races started to the overall data set

  • Inner join on Year and Season fields
Configuration and output of the inner join
  • Remove duplicate fields (Season)

6) Creating a Stages Won? field

  • If the Stage Number Won field is null, then Stage Won? will be No (Cavendish didn't win the stage).
  • If the Stage Number Won field is a number, then Stage Won? will be Yes (Cavendish won the stage).
Calculated field configuration for Stage Won?

7) Outputting the data

Overview of the final data set
Tableau Prep Workflow
Author:
Amelia Young
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2026 The Information Lab