Tableau charts: Slope chart
Updated: Sep 2
The series, Tableau charts has always focused on one thing, helping Tableau users learn how to create different charts and graphs hence equipping them with different techniques of telling each data story.
Therefore, inspired by the mission of this series, this post will help you learn how to build a slope chart in Tableau using table calculation Rank. Using data on ‘Main roofing type’ in Kenya, we’ll demonstrate how to compare use of ‘Corrugated Iron Sheet’ and ‘Asbestos Sheets’ for different County’s within the country. Our goal is to rank County’s in order of using a particular roof type.
Connect data set above to Tableau app and follow through to learn more.
Related use case: How to build a bump chart in Tableau.
Step 1: Compute rank of ‘Asbestos Sheets’
Create the table calculation below,
Under ‘Default Table Calculation’ compute using ‘County’.
Step 2: Compute rank of ‘Corrugated Iron Sheets’
Repeated Step 1 above but now using measure field ‘Corrugated Iron Sheets’.
Step 3: Let’s build our chart
Drag the calculated field ‘Rank -Asbestos’ to the rows shelf.
Notice the field is highlight in red, this is because our rank field is computed along the ‘County’, to correct this, introduce the field ‘County’ to the details shelf. (Since, my field is a hierarchy, I will drag ‘Province’ out of the details shelf to remain with County only).
Drag calculated field ‘Rank -Corrugated Iron Sheets’ to the axis as show below.
Chose Line under marks card.
Right click on the axis>>Edit Axis…
Step 4: Let’s do some formatting
Drag dimension field ‘County’ to the Label shelf.
Drag the measure field ‘Measure Values’ to the label shelf.
Select ‘Label’ shelf to open, edit as shown below.
Drag ‘Measure Values’ to the color shelf and remove lines.
From this view, comparison on use of Corrugated Iron Sheets and Asbestos sheets can be done with lots of ease. For instance, Nairobi county is ranked both No. 1 in use of the roof types, while Narok county is ranked No. 13 and No. 31 in use of Asbestos sheets and Corrugated Iron Sheets respectively. More insights can be draw without much strain.
I hope this article has been helpful to. See you in the next series of Tableau charts. Thanks for reading.