Tableau charts: Slope chart
Updated: May 17
Slope chart is used to show developments between two points. e.g., between two dates or fields.
Slope chart best practices
Always label the fields clearly.
Provide additional details on the tooltip.
Example of a slope chart
Therefore, this article will help you learn how to build a slope chart in Tableau using table calculation Rank. Using data on ‘Main roofing type’ in Kenya, I’ll demonstrate how to compare use of ‘Corrugated Iron Sheet’ and ‘Asbestos Sheets’ for different Counties within the country. Our goal is to rank Counties in order of using a particular roof type.
Connect data set above to Tableau app and follow along 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… and reverse the 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 was helpful to you. To receive more of the Tableau tips kindly join our mailing list by subscribing below.
Thank you for reading.