Chapter 66. How to Change Date Aggregation Using Parameters

Problem: Tableau makes selecting and changing the aggregation of a date dimension very easy while you are building a view. However, unless an end user is viewing an individual sheet in Tableau Desktop, she can’t easily pivot the date part between day, week, month, quarter, and/or year on her own.

Solution: Create a parameter that includes each date granularity option you want your end users to have access to (i.e., Day, Week, etc.), and create a calculated field that will act as your aggregation-changeable date.

In many cases, it makes sense to change the granularity of a line graph over time. The Sample – Superstore dataset, for example, includes four years of daily data. If you are trying to view your sales over time and you set the date aggregation to year, you are provided a 10,000-foot view of your sales trend, but no seasonal insight. On the other hand, set the date granularity to continuous day, and while outliers stand out, it is nearly impossible to differentiate between individual days because you are looking at more than a thousand marks at the same time.

As you can see, viewing your sales over time at different levels of date granularity will tell very different stories. Why permanently choose the date aggregation of your view when you can allow your end users to choose for themselves?

How to Change Date Aggregation Using Parameters

In order to provide you and your end users with the ability to change the ...

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.