This is a Quick Tip on how to build a Sin-Dumbbell Chart in Tableau, so less reading and more jumping in. We are going to spend 5 minutes or less building our Sin-Dumbbell in Tableau.
Note: As always never choose a data visualisation type and try to fit your data into it, instead, understand your data and choose the best visualization for your data consumers.
Data
Load the following data into Tableau Desktop / Public.
Social Network | Path | Value |
1 | 572 | |
181 | 572 | |
1 | 630 | |
181 | 630 | |
Medium | 1 | 210 |
Medium | 181 | 210 |
Tumblr | 1 | 120 |
Tumblr | 181 | 120 |
1 | 360 | |
181 | 360 | |
YouTube | 1 | 415 |
YouTube | 181 | 415 |
Note: we require path and duplicate lines for densification. See our tutorial on Data Densification for more information. Click here
Calculated Fields
We will start by creating the following calculated fields.
Path (bin)
- Right-click on Path.
- Go to Create, and select Bins…
- In the Edit Bins window:
- Set New field name to Path (bin).
- Set Size of bins to 0.1.
- Click OK.
Index
INDEX()-1
TC_Value
WINDOW_MAX(MAX([Value]))
TC_Max Value
WINDOW_MAX(MAX([Value]))
TC_Percentage
[TC_Value]/[TC_Max Value]
X
[Index]*[TC_Percentage]
Y
SIN(RADIANS([X]))
Size
IF [Index] = WINDOW_MAX([Index]) THEN
2
ELSEIF [Index] = 1 THEN
1
ELSE
0
END
Now that we have created our Calculated Fields, we will build our Worksheet.
Worksheet
Now that we have our Calculated Fields and Bin object, let us create our Worksheet:
- Change the Mark Type to Line.
- Drag Social Network to Color.
- Drag Path (bin) to Columns.
- Right-click on the object and ensure that Show Missing Values is checked.
- Drag this object onto the Path Mark.
- Drag X onto Columns.
- Right-click on the object, go to Compute Using and select Path (bin).
- Drag Y onto Rows
. Right-click on the object, go toCompute Using and select Path (bin).
If all goes well, you should have the following:
Let us make a small ammendment to the X Table Calculation:
- Right-click on X in the Columns, and select Edit Table Calculation.
- In Nested Calculations, choose TC_Max Value.
- Tick Social Network.
- Ensure that Social Network is below Path (bin).
- Drag Size onto the Size Mark.
- Right-click on the object, go to
Compute Using and select Path (bin).
- Right-click on the object, go to
You should now have the following:
Now we will adjust the cosmetics:
- Remove Grid Lines.
- Remove Zero Lines.
- Fix the Y-Axis to be between -3 and 3.
- Adjust the Size.
- Adjust the Color.
- Add a Tooltip.
- Hide the X and Y Headers.
- Drag Value onto Label and adjust.
You should hopefully end up with the following:
Note: You can use the following social media colors by copying this into your Preferences.tps file:
<?xml version='1.0'?>
<workbook>
<preferences>
<color-palette name="Social Media" type="regular" >
<color>#ea4c89</color>
<color>#3b5998</color>
<color>#ff0084</color>
<color>#dc4e41</color>
<color>#517fa4</color>
<color>#0077b5</color>
<color>#00ab6b</color>
<color>#40a4c4</color>
<color>#bd081c</color>
<color>#35465c</color>
<color>#55acee</color>
<color>#1ab7ae</color>
<color>#b31217</color>
</color-palette>
</preferences>
</workbook>
and boom, we are done with this Quick Tip. You can find my Sin-Dumbbell Chart on Tableau Public at https://public.tableau.com/profile/toan.hoang#!/vizhome/Sin-DumbbellCharts/Sin-DumbbellChart
Summary
I hope you all enjoyed this article as much as I enjoyed writing it. Do let me know if you experienced any issues recreating this Visualisation, and as always, please leave a comment below or reach out to me on Twitter @Tableau_Magic.
If you like our work, do consider supporting us on Patreon, and for supporting us, we will give you early access to tutorials, exclusive videos, as well as access to current and future courses on Udemy:
- Patreon: https://www.patreon.com/tableaumagic
Also, do be sure to check out our various courses:
- Creating Bespoke Data Visualizations (Udemy)
- Introduction to Tableau (Online Instructor-Led)
- Advanced Calculations (Online Instructor-Led)
- Creating Bespoke Data Visualizations (Online Instructor-Led)
yes enjoyed it.
Glad to hear 🙂
Do you have a tutorial where you explain the use of Window functions in TC_Value, TC_Max etc.? I’ve seen them repeatedly showing up in, but found it difficult to grasp the idea behind it. Thanks!
I will write an article about Tableau Calculations soon.
Thanks for your useful tips. I’ve learnt a lot. Can you take a quick look at TC_Value and TC_Max Value. Why do they have the same formula, which is WINDOW_MAX(MAX([Value]))?
Hi Phuc, TC_Value and TC_Max Value are table calculations that return the max value for the Value field. With table calculations, you can adjust the settings to bring back different values. I hope this helps.