Toan Hoang

Creating a Single Level Dendrogram in Tableau

My initial name for this tutorial was the Orgasmatron (head massager company name out of Australia), the name is fun, strange as hell but we have to have some fun right? Truth be told, I did not know what to name this delightful little chart type, so I asked Twitter and Facebook and most people said a Head / Scalp Massager; I was informed that there is an actual name for this would be a Dendrogram, so we will look at creating a Single-Level (Generation) Dendrogram in Tableau.

Note: This is an alternative type of data visualisation, and sometimes pushed for by clients. Please always look at best practices for data visualisations before deploying this into production.

Data

We will start by loading the following data into Tableau Desktop / Tableau Public.

CountryValue
United States95
United Kingdom70
France60
Germany55
Japan50
Italy65
Australia80
Canada80
Mexico75
Singapore90

Once your data is loaded into Tableau, right-click on the data source and click on Edit Data Source… with the Data Source Editor open, paste the following:

Path
1
100

Note: If you are using Tableau 2020.2 or great i.e. have access to new Relationship Model, you will need to double-click on the originally pasted data source to open up before pasting in the Path Data.

You should get an error as there is no joining column, however, click on Add new join clause, go to Create Join Calculation, type 1 and click OK. Do this for the right-hand side as well. Ensure that you have Inner join selected and you should see the following:

Note: we need additional records as we are going to be drawing lines and using densification to get more points on our canvas. For more information, check out our article on Data Densification.

Calculated Fields

With our data set loaded into Tableau, we are going to create the following Bin and Calculated Fields:

Path (bin)

TC_Value

WINDOW_SUM(SUM([Value]))/2

TC_Rank

RANK_UNIQUE([TC_Value],"asc")

X

((INDEX()-1)*0.12)-6

Using Data Densification, we are going to create 100 points from -6 to 6 with a step size of 0.12. This is required for the Sigmoid function that we will use to create a curved line.

TC_Sigmoid

1/(1+EXP(-[X]))

This is the Sigmoid Function that will take the X points and draw a curve.

Y

[TC_Sigmoid]*([TC_Rank]-(WINDOW_MAX([TC_Rank])+1)/2)/100

This is where the magic happens, and we adjust the value returned by the Sigmoid curve based on the rank of the country. On top of this, we want the middle point to be zero, so we subtract a value based on the number of countries or max rank.

With this done, let us start creating our data visualisation.

Worksheet

We will now build our first worksheet:

If all goes well, you should now see the following:

We will now adjust the Table Calculations to get our basic shape:

You should now see the following:

We will now adjust the cosmetics to get our final data visualization:

You will now want to have the following:

and boom, we are done! I hope you enjoyed creating this data visualization and learned some cool techniques as well. As always, you can find this data visualisation on Tableau Public at https://public.tableau.com/profile/toan.hoang#!/vizhome/Single-LevelDendrogramCharts/Single-LevelDendrogram

Extra Credit: reverse the Rows and Columns and have some fun with it.

Summary

I hope you all enjoyed this article as much as I enjoyed writing it and as always do share the love. Do let me know if you experienced any issues recreating this Visualization, and as always, please leave a comment below or reach out to me on Twitter @Tableau_Magic. Do also remember to tag me in your work if you use this tutorial.

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:

Also, do be sure to check out our various courses:

Exit mobile version