NICK PANNERI, CFE
 
  • Home

Using Time Intervals in Tableau

12/23/2016

0 Comments

 
To effectively plot dates and times in Tableau you sometimes need to do some prep work.  In this example we concatenate a ‘Date’ and ‘Start Time’ field and then we use intervals to ‘bucket’ the records into 15 minute time slots. 
Picture
Picture
In the above screenshot you can see the ‘Date’ and ‘Start Time’ fields that we will be concatenating. Begin by creating a calculated field:

  1. Select Analysis —> Create Calculated Field
  2. In the ‘Name’ text box, enter a name for the calculated field.
  3. In the ‘Formula’ text box, enter the formula below:

     DATEADD(
    ‘hour’, DATEPART(‘hour’, [Start Time]), DATEADD(
    ‘minute’, DATEPART(‘minute’,[Start Time]), DATEADD(
    ‘second’, DATEPART(‘second’,[Start Time]), [Date])))

The ‘Date’ and ‘Start Time’ columns are now combined into a single field.
Picture
In the above screenshot you can see how the data appears in the visualization. It's super busy, and perhaps it’s not very meaningful to visualize each minute of each day on a chart. So, you can then use more calculations to ‘bucket’ those records into 15 minute intervals.

To calculate your intervals, use this simple binning technique: There are 24 hours/day * 60 min/hr / 15 min bins = 96 bins.

Create a calculated field using this formula:

    DATETIME(INT(FLOAT([Datetime])*96)/96)​

and voilà……
Picture
Now you can visualize more dates and clearly see the trends and spikes in activity.
0 Comments



Leave a Reply.

    The views expressed in this blog are mine and do not necessarily reflect the views of Enterprise Holdings, Inc.

    Archives

    January 2017
    December 2016
    September 2016
    August 2016
    February 2015
    July 2014
    June 2014
    July 2013
    June 2013
    January 2013
    May 2012

    View my profile on LinkedIn

    RSS Feed

  • Home
  • Blog
Powered by Create your own unique website with customizable templates.