Another critical field classification is discrete vs. continuous. Ryan explains the single biggest myth in Tableau and his two rules of thumb for how to determine if a field should be discrete or continuous.
Hi, this is Ryan with Playfair Data TV. And in this video, I’m going to be discussing an important way that Tableau classifies all of the fields being used in your analysis, and that is as discrete or continuous.
Before I explain the difference, let’s take a look at some of the fields over here in the Sample Superstore dataset within Tableau Desktop. Note that every field that has been classified as a dimension has a little icon next to it, and it’s color-coded blue. All the fields that have been classified as a measure have a little icon next to them as well, and those are color-coded green.
For that reason, one of the most common myths for Tableau beginners is that the blue color-coding represents dimensions and the green color-coding represents measures. That is absolutely not what the color-coding represents. That color-coding represents whether the field is being used as discrete or as continuous. Anytime you see blue in Tableau, that field’s being used as discrete. Anytime you see green, that field is being used as continuous. It is a coincidence that by default dimensions are used as discrete and measures are used as continuous. But they can actually be both used either way.
To help illustrate, I’m going to throw together a quick chart here that looks at Sales by continuous month of Order Date. This is how I typically create a line graph. I put my measure on the view first. I then right-click and drag my element of time onto the view, which allows me to choose month with the green icon next to it. And again, the green is telling me that that is a continuous field. This would be a good choice if I was wanting to make a line graph that looked at something over time, because when you use a field as continuous, it draws a continuous axis on the view.
But I just mentioned, you can use these dimensions as continuous or discrete. So notice month of Order Date is a dimension, but it is not color-coded blue. At the moment, it is color-coded green, which is drawing a continuous axis. Watch what happens if I flip this continuous month of Order Date to discrete month of Order Date. You won’t see much change at first. Looks like the labels rotated a little bit. But under the hood, something completely different is happening.
Instead of drawing a continuous axis for my months over time, which would go in chronological order, Tableau is drawing headers for me. These are individual headers that can be moved around on their own, because they are unique headers. They’re a little bit hard to picture, but if I clicked on one, imagine a column going all the way up. Because I’ve got a month of Order Date on the Columns Shelf, it’s drawing a column, a unique column, for each of my months.
And those unique headers then can be sorted. I could sort these in descending order, for example, to see which month had the highest value of sales. Notice Tableau even tried to help me a little bit there when I sorted these in descending order. It automatically changed the mark type for me from Line to Bar because those headers aren’t technically related, and that line implies a relationship over time. But now that I’ve sorted these bars and these values, they’re no longer going in chronological order. So Tableau tried to help me change the mark type.
I’m going to undo just a couple of times to get back to Sales by continuous Month of Order Date to point out that when this is being used as continuous, I don’t even have the option to sort these in ascending or descending order.
So a couple of rules of thumb for you on discrete versus continuous– continuous fields draw continuous axes. Those axes cannot be sorted. I also want to point out, when we’re using measures on the view like Sales, it’s not a coincidence that that is also color-coded green. It’s drawing a continuous axis that cannot be sorted. It would be very confusing if we were using SUM of Sales, and we started with 120,000, and then we had 40,000, 85,000, and it was out of order. It’d be very confusing to do the analysis. So any time you are wanting to draw a continuous axis, you want to make sure that these fields are color-coded green.
When a field is blue, it is drawing discrete headers. That’s why it’s called that. Those are unique discrete items which can be sorted. So this might be a better option when you’re comparing categorical data, wanting to look at something like Sales by Category and sorted in descending order. You’d want to make sure that the field being used was blue or discrete.
This also has an effect on the color palettes that you’re using. If we were to put a continuous measure like Sales onto the Color Marks Card, we will get a continuous color palette. If we had both positive and negative values, we would also see a continuous palette. That’d be called a diverging palette. We talk about these custom palettes on another video here called How to Create Custom Color Palettes in Tableau if you want to take a look at that.
If we were to color these lines by a discrete dimension like Region, I’ll put Region on the Color Marks Card. Notice that it is blue. We get a completely different kind of color legend. This is a discrete color legend. And I can individually map those colors, because it’s four discrete colors that I can change.
But having a good understanding of discrete versus continuous is just going to help you get the exact results that you’re looking for in Tableau.
This has been Ryan with Playfair Data TV – thanks for watching!