Home Data Visualisations Designs Tableau QT: Rootogram

Tableau QT: Rootogram

0
1128

Last week our Tableau Quick Tip was on creating a Histogram with a Normal Distribution Curve. This week we are going to build a variation of this and our Rootogram (hanging Histogram on a Normal Distribution Curve). Hopefully, you have checked out our Histogram Tutorial, no worries if not, here is our Tableau Quick Tip on creating a Rootogram in 10 minutes or less.

Data

We will start by loading the Sample Superstore data into Tableau.

Note: If you have access to Tableau Desktop and the Sample Superstore data source, please use that instead.

Calculated Fields

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

Customer Count

COUNTD([Customer ID])

Sales by Customer

{ FIXED [Customer Name]: SUM([Sales]) }

We are using a LOD expression to get the total amount of Sales by Customer.

Mean

{ AVG([Sales by Customer]) }

We have no dimension as we want the mean to be calculated across the entire data set.

Standard Deviation

{ STDEV([Sales by Customer]) }

Size of Sales (bin) parameter

Unfortunately, Tableau does not allow you to use out-of-the-box bin in calculations, therefore, we will be custom building our own Bins; this is simple enough to do.

  • Set Name to Size of Sales (bin)
  • Set Data type to Int.
  • Set Current value to 500

Sales (bin)

INT([Sales by Customer] / [Size of Sales (bin)]) * [Size of Sales (bin)]

Normal Curve

(
    1/MAX([Standard Deviation])*SQRT(2*PI())
)
*
EXP
(
    -SQUARE(MAX([Sales (bin)]) - MAX([Mean]))
    /
    (2 * SQUARE(MAX([Standard Deviation])))
)

Note: This is the Gaussian Distribution Function, also known as the Normal Distribution.

Normal (Adjusted)

WINDOW_MAX([Customer Count])/WINDOW_MAX([Normal Curve])*[Normal Curve]

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

Worksheet

We will now build our worksheet:

  • Change the Mark Type to Gantt.
  • Drag Sales (bin) onto the Columns Shelf. Right-click on this object and select Dimension.
  • Drag Normal (Adjusted) onto the Rows Shelf.
  • Drag Customer Count onto the Size Mark.
    • Double-click on this object for inline editing, and add a sign to the front of the expression.
  • Drag Normal (Adjusted) onto the Rows Shelf.
    • Change the Mark Type of this second pill to Line.

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

Now, we just need to adjust the cosmetic, and we will have our Rootogram:

  • Right-click on the Normal Adjusted Pill and select Dual Axis.
    • Right-click on the axis header and select Synchronize Axis.
  • Adjust the Colors
  • Adjust the Size
  • Adjust the Tooltips
  • Hide one of the Axis Headers
  • Remove the Column Zero Lines.

You should hopefully have something like the following:

Please do try to experiment with different Vales (Quantity, Profit etc) and to also adjust the size of the bin to get a smoother line, and with that said, and boom, we are done! I hope you enjoyed this tutorial, and as always, you can find this data visualisation on Tableau Public at https://public.tableau.com/profile/toan.hoang#!/vizhome/Rootogram/Rootogram

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 Visualisation, 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:

NO COMMENTS

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to our mailing list to keep up to date.