Tableau — User Selectable Time Metric

Parag Kar
2 min readJan 25, 2023

--

One of the very important aspects of data science is the visualization of data. I have been working on Tableau for some time now. This has been a journey that has helped to unlock the potential of raw data for it to tell a story. In this process, I have discovered some tips which I have found very useful. In this series of notes, I plan to share this with all. This will serve two purposes — a) as my own reference; b) and as a reference for all those interested.

Use Selectable Time Metric

Allowing a user to select a time metric (month, quarter, year) gives a very powerful option to enable to see the trend embedded in the time series quickly, and flexibly. This is important as the short-term monthly trend might not allow us to see the full picture. Hence, zooming out and viewing the granularity at the quarterly or yearly might be quite useful. To enable this flexibility one needs to follow these steps.

Step1 — Defining a Parameter (Time Metric)

The picture below is a screenshot of the process that one needs to follow while defining the parameter.

Figure1 — Defining Parameter (Time Metric)

Step 2 — Create Custom Dates

The process is captured in the following figure.

Figure 2 — Creating Custom Dates

You need custom dates for the month, quarter, and year. The custom date is nothing but the following formula = DATETRUNC(“month”,[Order Date]). Similarly use it to define, “quarter” and “year”.

Step3 — Create a Calculating Field (Time Frame)

The process is captured in the following figure.

Figure 3 — Creating a Calculated Field

Step4 — Use Calculated Time Frame as the Dimension

The process is captured in the following figure.

Figure 4 — Final View

Now the granularity of the view will change as you select a particular time metric from the drop-down menu on the right.

Hope you found this useful. Thanks. More tips to follow.

--

--

Parag Kar
Parag Kar

Written by Parag Kar

EX Vice President, Government Affairs, India and South Asia at QUALCOMM

No responses yet