How to build a dynamic control chart in Tableau

The control chart is used to study how a process changes over time and allows us to identify any significant outliers in our data. Here is a guide on how to build a dynamic control chart in Tableau.

A control chart is made up of 3 parts: the distribution band, the line plot and the dot plot. When any of the dots are outside of the distribution band, they will be coloured so that our user can identify the outliers. In this guide I will also show you how to create a parameter that allows our user to determine the size of the distribution band.

Step 1: Build the line and dot plot

In this case I am using London Airbnb Listings data to look at monthly average room prices, so I’m going to drag my date into columns and average price into rows to make my line plot.

Now that we have our line chart, add dots by ctrl + left clicking your measure and dragging it to the right in the rows column, this will duplicate the line. Next change the mark type of the 2nd plot to circle, right click the axis and select dual axis, then right click the axis again to synchronise the axis like so:

Step 2: Create a parameter

This parameter will allow the user to control the size of the distribution band. To set this up, select ‘float’ for the data type, set current value to 1 and ‘allowable values’ to all. Once this parameter has been made, right-click it in the data pane and select show parameter.

Step 3: Create calculated fields for the distribution band

First we want to create our upper bound, this will be calculated using the window average of our average prices plus our standard deviation of average price multiplied by our parameter. The calculation should look something like this:

For our lower bound, copy the calculation above but change the ‘+’ to a ‘-’.

Step 4: Create the distribution band

Drag the upper and lower bound calculations onto detail in the marks card. Now go to the analytics pane and drag a reference band into the view like so:

To configure the distribution band, change the ‘Band From’ value to your lower bound, and your ‘Band To’ value to your upper bound. In this configuration window you may also format the band as you please. I have removed the labels but feel free to play around with the customisation.

Step 5: Add colour to your outliers

To do this we will need to create one last calculated field which will return three string values; ‘Above’, ‘In Between’ and ‘Below’. We will use these strings to colour our outliers based on the average prices position relative to the band. The calculated field should look something like this:

Drag this calculated field onto colour in your dot plot marks card and edit the colours as you please.

After some formatting (increasing the size of the circles, editing the colours and removing grid lines) here is what our finished product looks like:



Author:
Edward Gay
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2024 The Information Lab