Do you know how DATES work in Tableau? Understanding Continuous vs Discrete Dates
Do you know how dates work in Tableau? It could be tricky, but once you get a handle on it, it can make your Tableau life much simpler.
The first step to understanding dates in Tableau is understanding the concept of discrete and continuous first. These are two very important concepts in Tableau that, if not clearly understood, can definitely cause a lot of confusion (and headaches). It can make you think you’re getting unexpected vizzes or behavior from the application, and that it’s not doing what it’s supposed to do.
A quick Google search lands us the definitions for these two terms:
discrete – individually separate and distinct
continuous – forming an unbroken whole; without interruption
Let’s tie these two terms back to Tableau:
|definition: individually separate and distinct||definition: forming an unbroken whole; without interruption|
|blue pill||green pill|
|gives you headers||gives you axes|
In Tableau, dates are special. For the most part, once a field is identified as a date, Tableau automatically creates date hierarchy, ie, a date will allow you to drill down from year to quarter to month to day. (Note I’ve mentioned “for the most part”, because there are exceptions to this, which I will defer to a later blog post. )
Dates can also either be discrete or continuous – it completely depends on how you want to visualize your data, or how you want to analyze your data.
Blue pill = discrete, which means distinct values, which this will generate headers for us.
When you click on the + sign that appears on the left side of this pill, you are able to navigate down the hierarchy. But notice that as you expand the hierarchy, you are also creating additional discrete pills.
Tableau dates can also be continuous.
A continuous date will be manifested as a green pill.
Green = continuous, which means contiguous, unbroken values in a range, which means this will generate an axis for us.
This axis represents the “real” time continuum. Continuum by definition is “a continuous sequence in which adjacent elements“. In this case, time in sequence. 2009 will always come before 2010, and so forth.
There a few ways to create a continuous date. Here are a couple:
- Once you drag the date field onto the shelf, right click on the pill (or hover over the pill until you see the dropdown arrow, and then click on that) to reveal the context menu. One of the options here is to convert the field to continuous, or you can also select one of the predefined dates in the continuous block (see area highlighted in green)
- Instead of dragging the date field onto your shelf, you can right click + drag your date field onto the shelf. Once you drop the field, a window appears with a list of possible values (or variations) you may want for your date field. The different sections are illustrated below, but this allows you to directly choose a continuous format instead of getting a discrete and then having to convert it to continous.
Tableau also creates a natural date hierarchy for continuous dates (with some exceptions, notably for dates derived from cubes). This is the same hierarchy it creates for discrete dates, which starts off with year, then quarter, then month, then week, then day. However, the behavior is different. When you drill down on the hierarchy, no additional pills are created. Only one pill is maintained in your shelf. The lower level hierarchy (ex quarter) replaces the higher level hierarchy (ex year).
However, notice that as you drill down the hierarchy, your axis expands and now represents more information.
Visualizing Discrete vs Continuous Dates
I tried to think of how to best visualize this concept, and this is what I’ve come up with:
For me, discrete dates are like LEGO pieces. You can take them apart.
Remember, once you drill down to the hierarchy, you get multiple “pieces” of date. Once you take them apart, you can work with each of the pieces differently and independently. You can move them around and analyze them in different orders.
For me, continuous dates are like a roll of yarn.
When you unroll or unravel the yarn, you don’t get multiple pieces, but you just see more of the yarn. You get a longer piece of the same string. The beginning of the string is still the beginning of the string, and the end of the string is still the end of the string. You still have one string, you just see more of it. And this is exactly what the continuous date does. It expands the detail you are seeing on your screen.
Anyway, that’s my take on discrete vs continuous dates in Tableau. Hope that helps. Happy Tableau’ing! Everything is awesome!