Tableau Tip: How to Create a Dynamic Time View

by Emily Chen

I’ve created a dynamic time parameter so that the x-axis starts at a different date based on the number of days from today.

Any business collecting sales for delivery into the future (any business that involves bookings or shipping) would find this incredibly valuable.

Here’s a view of the chart for reference before I start. We want to create a way to control the view so that it starts x number of days from today. Note that today is September 2, 2015 but the dataset starts from August 1, 2015.

ship date image

Step 1: Create a Parameter

I’ve called mine “Days Before Shipping”. Here’s the configuration where I’ve set the range to values to span for 1 year.

days before shipping

Step 2: Create a Calculated Field

This is the part I got stuck on for a bit where I couldn’t quite match how a date + days (different metrics) could work together. Luckily I found the dateadd() function!

We want to create a view that is:

Today’s date + x number of days <  ship date

Here’s the calculation:

Days before Shipping

 

If you’re a bit confused, hopefully this crosstab view will help understand what we’re asking Tableau to do: for every value where this above statement is true, give me that view.

crosstab view

Step 3: Put the New Calculation on Filters

And select “True”

filter

 

Voila! You’re done!

 

ezgif.com-video-to-gif