2022: Week 47 - Chelsea Managers per Prime Minister

Challenge by: Stephen Moyse

It's been a tumultuous time for UK politics recently, with 3 different Prime Ministers so far this year! Similarly, being a football manager isn't always the most secure a position. So what's the relationship between the 2? Just how many Chelsea Managers have there been for each Prime Minister? 

The challenge was a brilliant idea brought to us by data schooler Stephen Moyse and we're excited what other ideas he will bring to us in future!

Inputs

  1. Prime Ministers 

  2. Chelsea Managers 

  3. Chelsea Matches 

Requirements

  • Input the data
  • For the Prime Ministers data:
    • Group together Sir Winston Churchill and Winston Churchill
    • Split the dates to create Start Date PM and End Date PM
      • For the null End Date PM, replace with today's date
    • Create a row for every day the Prime Minister was in office
  • For the Chelsea Manager data:
    • Remove unnecessary fields and rename remaining fields
    • Clean the Chelsea Managers field
    • For the null End Date CM, replace with today's date
    • Create a row for every day the Chelsea Manager was in place
  • For the Chelsea Matches data:
    • Filter to only include the main competitive matches:
      • League
      • League Cup
      • F.A. Cup
      • Europe
    • Make sure the Date is a Date Data Type
    • Pivot the data so we know how many matches were won, drawn or lost on each day
    • Create a Matches field, so we know the number of matches played each day
  • Bring the 3 datasets together
  • Aggregate so that we are able to count the number of Chelsea Managers for each Prime Minister, as well as how many Matches were played during their time in office and the breakdown of their outcome
  • Calculate the Win % for each Prime Minister
    • i.e. Matches Won / Total Matches
    • Rounded to 2 d.p.
  • Output the data

Output

  • 9 fields
    • Prime Ministers
    • Start Date PM
    • End Date PM
    • Chelsea Managers
    • Matches
    • Matches Won
    • Matches Drawn
    • Matches Lost
    • Win %
  • 19 rows (20 including headers)
You can download the full output here

After you finish the challenge make sure to fill in the participation tracker, then share your solution on Twitter using #PreppinData and tagging @KaizenStephen@Datajedininja@JennyMartinDS14 & @TomProwse1

You can also post your solution on the Tableau Forum where we have a Preppin' Data community page. Post your solutions and ask questions if you need any help!

Popular posts from this blog

2023: Week 1 The Data Source Bank

2023: Week 2 - International Bank Account Numbers

How to...Handle Free Text