Chapter 67. How to Equalize Year-Over-Year Dates
Comparing an exact date in the current year to the same date in prior years—at least on the same date axis—is tricky in Tableau. The challenge comes from the lack of a “Month/Day” date part option when using dates in Tableau. If I were to right-click and drag the Order Date dimension from the Sample - Superstore dataset in Tableau to the Columns Shelf, I am presented with these options:
Order Date (Continuous) Order Date (Discrete) YEAR(Order Date) QUARTER(Order Date) MONTH(Order Date) DAY(Order Date) WEEK(Order Date) WEEKDAY(Order Date) MY(Order Date) MDY(Order Date) CNT(Order Date) CNTD(Order Date) MIN(Order Date) MAX(Order Date) YEAR(Order Date) QUARTER(Order Date) MONTH(Order Date) WEEK(Order Date) DAY(Order Date) ATTR(Order Date)
The only choices that include the most-granular, day-level aggregation that I want to use, also include year. This prevents me from having the lines for each year in my analysis overlap for easy year-over-year comparison. It also makes it impossible to choose a date range such as 2/1/2018–3/30/2018, and still be able to see a line for all of the years in my data (this range would filter the data to just the year 2018). To illustrate, if I looked at the Sales measure in the Sample – Superstore data by the continuous DAY(Order Date)
, then colored the lines by YEAR(Order Date)
, the view would look like this:
And if I wanted to choose a smaller range such as 2/1–3/30 for each year:
No luck because ...
Get Practical Tableau now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.