Early bird tickets for Inspire 2023 are now available! Discounted pricing closes on January 31st. Save your spot!

Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
wdavis
Alteryx
Alteryx

Cricket is one of the most popular sports globally, and from an analytics perspective, it is an absolute gold mine! With games played year-round, across multiple formats, and with 1,000s of data points, the question is often not what can we analyse, but what should we start with?

 

I took the recent Twenty20 World Cup taking place in Australia as the perfect launch point for this analysis. I wanted to create the perfect guide for any commentator, reporter, or avid fan who was heading to a match and wanted to be well prepared.

 

The Data

 

The first part was to see what data was ready and accessible to start the analysis. Cricsheet is an amazing website that has ball-by-ball data for pretty much every cricket match and is constantly updated. I limited my scope to International T20 matches and downloaded the data in a JSON format.

 

Data Clean Up

 

No analytics blog is complete without talking through the fun of data cleansing.

 

There were over 2,300 games to analyse and each one looked like this to begin with:

 

image001.png

 

Therefore, the Cricket Macro was created to provide 2 outputs; one focused on the Games and the second focused on the Players.

 

image002.png

 

image003.png

 

Historical Analysis

 

Watch the video here: Sports Analytics - Cricket Analysis Part 1.

 

Then it was a case of deciding what would be interesting to see from the Team perspective: Overall Records, H2H between teams, and Toss Decisions were selected.

 

Then from the player sideMost appearances, win rates, and MoM performances. Then drilling down into these with a focus on just T20 World Cup games.

 

The App

 

Watch the full video here: Sports Analytics - The Commentators Guide to Cricket.

 

In the second part, I wanted to take this analysis a step further and create “The Commentators App,” which would allow them to add in the elements of the game they’re watching, and produce a detailed report they would be able to use during the game. Self-Service at its best!

 

image004.png

 

Once they’ve selected the ground they’re at and the teams who are playing, the report will then be generated with the following information:

  • Ground stats - par score, highest scores, super overs, whether it’s best to bat or bowl first
  • Team stats - What they do at the toss and how it impacts results, H2H records
  • Player Stats - It will identify 2 key batters and bowlers from the sides and analyse their stats; Averages, Strike Rates, runs scored, wickets taken, matches played etc.
  • Next Ball Actions – Taking the data to the next step by trying to understand what a player will do next. E.g, we can look at a batter and what they are likely to do after they hit a 6, e.g, 25% of the time, they go on to hit another one!

 

image005.png

 

The beauty of the app is that it takes seconds to re-run for any game. Meaning that any commentator, fan, or cricket nerd can quickly update the stats as and when they need them.

 

Workflows

 

Both Workflows that have been used are attached to the Blog.

  • In Part 1, I have included 1 file as an example, but to fully utilise the batch macro, you can download more of the files from https://cricsheet.org/
  • In Part 2, I have included the data files exported from part 1, so no requirement to download any additional files.
    • The workflow isn’t particularly clean but can be uploaded to a Server environment or run as an app immediately to see the output

 

Howzat!

 

This was a project I loved doing, maximizing the Alteryx platform whilst analysing a sport I love! This is very much touching the surface of what is possible in the Cricket Analytics space. From Cricsheets alone, you can start to explore how T20 performance might compare to other formats.

 

Stay tuned for further cricket-based content, and please reach out if you’d like to be involved!

 

Will