How to Set up a Date Granularity Filter in Tableau

Chi
2 min readMar 11, 2021

--

Download template of this stock tracker dashboard here

For time-series data, it’s often helpful to give users the options to choose the date granularity to best gauge the trend over time.

And you can achieve this in Tableau! Here’s how:

  1. Create a parameter as the filter for users to select
  • Data type: string
  • Available values: list
  • List of values is granularity levels you want: Day, Week, Month, Quarter, etc.

2. Create a new Date field based on the parameter you just created and the original date field.

The logic in the code below is when the parameter selected is ‘Day’, change the granularity of the original date field to ‘day’ level using DATERUNC(). Use the same logic for other levels of granularity.

3. Put the newly created date field into the sheet and set it to ‘Exact Date’. Also, add the Date Granualarity parameter into the sheet.

The final result:

--

--

Chi
Chi

Written by Chi

Books | Marketing | Data Viz | Analytics & Experimentation | Entrepreneurship 💡Founder of beautydupes.xyz | Blog: goodmarketing.club

No responses yet