In this video I tackle the subject of slope graphs also known as slope charts. I had some fun putting together this dashboard that illustrates the changes in wins for NBA teams during the 2016-2017 and 2017-2018 seasons. From the video you’ll discover that Chicago, Atlanta and Memphis are on a Hindenburg-like trajectory, while trusting the process in Philadelphia led to huge season gains in overall wins.
Here’s what you will learn from this video:
- How to create a parameter that enables a user to select which win statistic measure to visualize;
- How to use Table calculations like, LOOKUP(), FIRST() and LAST() to calculate period over period change;
- How the impact of Mike Conley’s injury affected the Memphis Grizzlies last season;
Click the pic to interact with the Tableau Public visualization, also download the workbook and data to dissect as needed.
For your convenience the calculated fields that I used to create the measures are listed here. Note that [Selected Measure] is a parameter that you need to create that lists all of the measures.
Calc Select Measure
CASE [Selected Measure]
WHEN “Home Losses” Then [Home Losses]
WHEN “Home Wins” Then [Home Wins]
WHEN “Overall Losses” Then [Overall Losses]
WHEN “Overall Wins” Then [Overall Wins]
WHEN “Road Losses” Then [Road Losses]
WHEN “Road Wins” Then [Road Wins]
WHEN “vs East Conf Losses” Then [vs East Conf Losses]
WHEN “vs East Conf Wins” Then [vs East Conf Wins]
WHEN “vs West Conf Losses” Then [vs West Conf Losses]
WHEN “vs West Conf Wins” Then [vs West Conf Wins]
Better or Worse
IF [Selected Measure] = “Home Wins” OR
[Selected Measure] = “Overall Wins” OR
[Selected Measure] = “Road Wins” OR
[Selected Measure] = “vs East Conf Wins” OR
[Selected Measure] = “vs West Conf Wins”
//WIN MEASURES: Negative delta treated as “WORSE”, Positive delta treated as “BETTER”
(IF [Delta] < 0 THEN “WORSE” ELSEIF [Delta] = 0 THEN “SAME” ELSE “BETTER” END)
//LOSS MEASURES: Positive delta treated as “WORSE” (more losses are worse), Negative delta treated as “BETTER”
(IF [Delta] > 0 THEN “WORSE” ELSEIF [Delta] = 0 THEN “SAME” ELSE “BETTER” END)
LOOKUP(SUM([Calc Select Measure]),LAST()) – LOOKUP(SUM([Calc Select Measure]),FIRST())
Delta ABS Value
ABS(LOOKUP(SUM([Calc Select Measure]),LAST()) – LOOKUP(SUM([Calc Select Measure]),FIRST()))
<Team> Trend: <AGG(Better or Worse)> by <AGG(Delta ABS Value)>
During the <Season> Season, the <Team> had <SUM(Calc Select Measure)> <Parameters.Selected Measure>.
I have to give thanks to Ben Jones at the Data Remixed blog for the inspiration!
As always, If you find this type of instruction valuable make sure to subscribe to my YouTube channel.
All views and opinions are solely my own and do NOT necessarily reflect those of my employer.
Hi Anthony, I am a regular follower of your videos on tableau in youtube and subscribed as well. Firstly, let me start by congratulating you on behalf of the entire tableau community for the amazing work that you are doing , your videos are really very informative. I had just one question, in the video that you have shared on slope graph, it seems that measures like “Home Losses”, “Home Wins ” etc are calculated fields (from the symbol =#). However, you did not mention them in the video. Is there any specific logic to derive them? When I have downloaded the full data set, I got them as measures (without =#).I will be glad if you can reply .
Hi Arpan, thanks for commenting and subscribing to the channel on Youtube. In the original file that I downloaded from basketballreference.com, all of the Win-Loss records are together in one field. For example Overall Record would contain the value “58-24”, where 58 is the number of wins and 24 is the number of losses. I used a split transformation in Tableau to split the wins and losses into their own separate fields. I then made all of the respective wins and loss columns measures. Hope that helps!