Updated: Jan 14, 2019
What I will cover:
1. A couple easy data investigation views to set you on the path to picking the right viz.
2. Parameter Controlled metric selector
3. How to build a bump chart.
4. How to build a panel chart.
5. Applying viz-in-toolip
One of my favorite things about #MakeoverMonday is the diverse data sets and myriad of creative approaches to displaying them across the Tableau Community; that also makes it very difficult to avoid seeing a hundred examples on Twitter and Tableau Public when trying to figure out what viz to pick. My best advice is to stick to looking at the data first (not Twitter, Public, Reddit, or even my Bruins pocket schedule…)
What is in this data set?
Team, season (date), number of home and away games, home and away attendance totals, then a rank by home attendance total.
The first thing that comes to mind is “That rank is weird.”
The seating capacity and surrounding population density could have significant impact on home attendance. If we had the data showing away attendance total as a % of the total seating capacity for each game played on the road, perhaps we could see who had the widest spread fan base, but I don’t want to be hunting the schedules and attendance for every single NHL game over the last 18 years. An easier complimentary data set to acquire is the rink name and seating capacity for each NHL team.
What I wanted to know, is what teams pack their barn every single night, what teams have the biggest road draw, and how much do cup wins impact these rates.
Back to the data.
I spent a few minutes on Wiki and found this list of all NHL rinks and their capacity. https://en.wikipedia.org/wiki/List_of_National_Hockey_League_arenas . After making sure I had a good alignment of team, arena, and capacity by year, it is time to jump into Tableau. If I throw the seating capacity for each rink onto a number table, it looks close.
If I hold down ctrl and drag the text pill to size after switching the mark type to bar, I can quickly create a no-axis bar chart.
This is much easier to analyze for me. What is data is saying to me is that these is not much difference between rink sizes across the NHL, about 20% variance between the biggest and smallest rinks.
Another good way to investigate a data set like this is with a quick highlight table. Drag seasons onto columns and teams onto rows with the total home attendance as the text value and color. The lock out in 04-05, the strike shortened 2012-13, and the expansion addition of the Vegas Golden Knights immediately stick out here.
While some may like to forget work stoppages in professional sports, I want to included them in this viz. As a hockey fan myself, I cannot ignore the entire 2004-05 and half of the 2012-13 seasons taken from the fans due to labor disputes. I might have to format around Vegas’s recent arrival but strikes and lockouts are important to consider in the final views.
At a close look, the Havs row looks consistently dark, and I can also see the Blackhawks recent resurgence. However, trending data for a group is best represented from left to right and using a vertical axis or size element for each record. Line charts are an easy one;
Now the work stoppages really stick out, but my goal was to find out what home venues have the best attendance % and what teams have the best road draws. Given that the records have a relatively tight range of values, I am going to go with a bump chart. Bump charts show ranks in a combination line and shape chart that allows the end user quickly see the entire league, and interact with the viz to highlight specific teams. Here is one of my favorites from Zen Master Matt Chambers https://www.sirvizalot.com/2018/11/how-to-create-expanding-bump-charts.html.
Time to viz;
First thing I want to build are some calculations to allow the end user to select between four different ranked metrics: home attendance, road attendance, home attendance sell out %, and total attendance. This will be controlled by a parameter.
Create a parameter using a LIST of STRING values.
We will get back to that parameter shortly.
Next, I want to build out the rank calculations for the different metrics. Rather than memorizing all of the table calculation and aggregation syntax, I try to let Tableau do the work whenever and possible. Once I get one, I can copy, paste, and edit the rest. Using the value I already had populations (sum(home attendance)) use the following settings.
Now I can click on the measure pill to locate the “Edit in Shelf” option which allows me to copy out the calculation.
Then just copy, paste into a new calculation, and be sure to rename the field and change the default table calculation settings to the TEAM level as the default will look across the entire table and give a unique rank for the team’s season performance, not compared to other teams in the same season.
Repeat this process for the road and total attendance ranks.
The most interesting metric to me is the sell out %. This is created by dividing the home attendance by the seating capacity for each arena multiplied by the total number of games played. I did that work in the data in excel for this example, but a nest table calculation could accomplish the same thing.
Once I have that bit, I can make another rank calculation which is the final one for this viz.
Next is to create a calculated field that references the user selected metric to display the correct rank. For this, use a CASE statement. This simply means that you are telling Tableau that in the CASE of the parameter section, WHEN is it X give me y.