In today’s blog, I will be disentangling the confusion about three particular Tableau topics:
- Discrete vs continuous
- Blue vs green and
- Dimensions vs measures in Tableau.
Discrete and continuous are mathematical terms that are used when describing data. If you aren’t quite sure what these terms mean, please read my blog about discrete and continuous data. Blue and green, and dimensions and measures are slightly more Tableau specific, and I will cover all of these topics and how they are each related in this blog.
Before we get into the nitty gritty, I would like to point out that many people tend to conflate discrete with dimensions and continuous with measures in Tableau.
Blue = discrete ≠ dimensions while green = continuous ≠ measures
Tableau separates data in several ways, it distinguishes data types using icons, it identifies continuous or discrete data using colour and it distinguishes dimensions and measures by where they are placed within the Data sidebar. Looking at this screen grab (to the right), you can see that Tableau separates data into dimensions (above the line) and measures (below the line).
Measures are usually continuous (green), and dimensions are usually discrete (blue) — this is why people tend to mix them up. These are the most common combinations because they are most frequently what is required for visualisation creation needs. It is however possible, and sometimes required, to have a discrete measure or a continuous dimension.
It is important to understand how Tableau works with measures and dimensions as well as continuous and discrete data. Once you understand this, you will be able to easily fix unexpected viz results in Tableau. Each of these elements work together to influence your visualisations in Tableau.
I will be focusing on numbers. Though Tableau technically allows you to convert a string to a measure by turning it into a number (it does this by doing a COUNTD() calculation on the field). By its very nature, continuous data must be numerical. Though numerical data is usually a continuous measure, there are cases where you may want numerical data to be a discrete dimension. You would do this for things like ID number of Post Code, where these are distinct values that have no use in being aggregated.
High level overview
What are the fundamental characteristics of each of these types of Tableau data and how should you expect them to behave?
|Above the line
|Disaggregate by default.
|Below the line
|Aggregate by default.
|Creates headers/labels of distinct categories.
|Creates a continuous axis.
Discrete and continuous are mutually exclusive, as are dimensions and measures. However, a measure can be either discrete or continuous and so can a dimension.
The following table covers each possible combination of these types of data. It is your cheat sheet for this topic and all you need to remember about blue vs green, continuous vs discrete and dimensions vs measures in Tableau.
(above the line)
|Create headers/distinct categories of disaggregated data.
|Create a continuous axis of disaggregated data.
(below the line)
|Creates headers/distinct categories of aggregated data.
|Creates a continuous axis of aggregated data.
So that’s the basic overview, but let me try to demonstrate this with some examples.
Getting into examples
I have created a simple data set of two stores and their monthly sales over 3 years.
The First Store has the exact same pattern of sales every single year, while the Second Store’s sales varies. You can see that some values repeat within the year or over different years. This is only significant to note for later on when we see the way Tableau aggregates values.
For demonstrational purposes I have taken the Sales value, which was a continuous measure (renamed to “Sales (Msr Contunuous)”), and I have duplicated it three times to create a continuous dimension (called “Sales (Dim Continuous)”), a discrete measure (called “Sales (Msr Discrete)”) and a discrete dimension (called “Sales (Dim Discrete)”). I have done this to not only demonstrate that this is possible, but to also show you what can result from different combinations of these.
To demonstrate some of the differences between dimensions/measures and discrete/continuous, I have created a few charts. With my fake store data.
Example One – a focus on continuous behaviour
You may have noticed when using Tableau that you can only create certain chart types with certain types of data. You need two continuous measures which are then split up by a dimension to create a scatter plot, for example.
This first example is a very unrealistic to begin with as I have the same value on both the columns and rows shelf. I have done this however, to be able to more easily compare it to later charts.
For this demonstration I am using data from the First Store. As we know, Store One’s sales increase by $100 per month every year, this is why we can see the perfect separation between all points. And of course, the perfect positive trend is due to the x and y axis being the same (which we would not do in real life).
Continuous Measures need dimensions to disaggregate
A continuous measure is used in both the rows and columns shelf; therefore, a continuous axis is created along both the x and y axis. We can see that the axes are made up of aggregated values. If we look right at the very bottom left corner of the screenshot, we can see that there are 12 marks in the view. This is because the viz is split up by the discrete dimension in the detail marks card.
Continuous Measures without dimensions
Now, let’s see what happens when I remove the dimension from detail in the marks card.
We can see that only one point is now showing on the scatter plot. This is because measures aggregate and dimensions disaggregate. Dimensions are used to split up the data. Measures do not add marks to a visualisation, they simply show an aggregation. If there are no dimensions in the visualisation, then it will only show the highest-level aggregation. Looking in the bottom left corner again, we see that there is only one mark showing in the viz.
Continuous Measures Against Continuous Dimensions
What happens if I add the sales discrete dimension back to the detail marks card and then replace continuous measure on the columns shelf with a continuous dimension?
It still looks like a scatter plot, but if you look carefully, you can see that the Automatic mark type has changed to line. Furthermore, the x axis is no longer a continuous axis, but distinct header values for each point to fit into. The values for these have also changed and are no longer aggregate values (which you can still see on the opposing axis). Also note (looking in the far bottom left corner) that there are 12 marks in this viz.
So, what happens now if I remove the discrete dimension? Will we have one mark as before?
We can see that the line chart is finally able to look like a line chart. But unlike before when we had only one mark in the viz, we still have 12 marks in this viz. This is because it is not distinct data, but dimensions that disaggregate the data. Here we have disaggregated header values created by the continuous dimension.
Example Two – a focus on discrete behaviour
Continuous Measure and Discrete Dimension
In this following viz I have placed the continuous measure of sales on the columns shelf and the discrete dimension of sales on the rows shelf. We can see that the rows are divided into headers, and the headers are made up of each of the sales values represented in the first table displayed in this blog (therefore not an aggregation). We can also see that the length of the bars is this value multiplied by the number of times this value occurs. To make this clear, I have added the discrete dimension, along with its count, to the Label. With this you can see the result (of the discrete dimensions multiplied by its count) is the continuous measure value. This is logical, because we know that continuous measures are always an aggregation and represented along an axis.
Continuous Measure and Discrete Measure
Now, what happens if I replace the discrete dimension of sales with the discrete measure?
Well, we know that discrete = headers, and measures = aggregation. And as we can see in the following image, that is exactly what has happened.
We can see the values in the rows are now not those found in the original table, but aggregate values. And because I have kept the colours mark to remain the discrete dimension as well as the labels to be the same as before, we can see how tableau has created these aggregations. For example, both one count of $1800 sales fits into the discrete $1800 header/row, but two counts of $900 (an aggregation), also fits into this row. The combination of the two bars on this row extend along the continuous axis to reach $3600 — the continuous measure value.
And in case you were curious, the second I remove the dimensions from the Marks cards, this happens.
This is because measures aggregate and can only be disaggregated using dimensions.
How does this affect colours and filters in Tableau?
One last thing to think about with regards to continuous and discrete data in Tableau is how this works with colours and filters. I will be covering more on working with continuous and discrete data in Tableau in a future blog. But for now, know that colouring with discrete dimensions create distinct colours, whilst continuous measures will create a colour scale. As is illustrated by the below image using a continuous measure, as compared to the above examples coloured using discrete dimensions.
Rounding up and further resources
Though this is a very fundamental topic in Tableau, it is actually quite complex. It is also often overlooked by many Tableau users, even those who have been using the software for years.
Now, I know some of you might be frustrated that all of my examples were not very practical. I specifically chose to do this because this is a rather theoretical concept that I wanted to explain clearly. I have taken an approach that I have not seen anyone else take on this topic and it might help to hit it home for some people. If you would like to see other examples, I would recommend the following resources.
You can do further reading on this topic in Tableau’s official documentation. If you would like to watch some videos about it, you can watch this one by SQL Bell or this fantastic explanation by Andy Kriebel.
I hope I have given you some things to think about with regards to this fundamental topic of blue and green in Tableau and dimensions vs measures. Don’t worry if this concept hasn’t fully sunk in yet. I recommend you play around in Tableau yourself and see how these different factors influence your visualisations.