KNOWLEDGE BASE

Binning Dates for Custom Date Levels


Published: 13 Apr 2017
Last Modified Date: 26 Dec 2017

Question

How to break a date field down into non-standard increments, such as 2 months or 15 minutes. 

Environment

Tableau Desktop

Answer

The below instructions create a view showing flight delays by day of month, broken down into 2-day increments, and are based on the attached packaged workbook DateInterval.twbx.
  1. Select Analysis > Create Calculated Field
  2. Name the field Flight Delays, enter the following calculation, then click OK
    DATEPART('day', [Flight Date]) 
  3. in the Measures pane, right-click Flight Delays and select Create Bins
  4. Name the field 2 Day Intervals, enter 2 for Size of bins, then click OK
  5. Drag 2 Day intervals to Columns.
  6. Drag Arr Delay to Rows.
  7. Right-click Arr Delay on Rows and select Measure > Average
  8. Place Dest State on Color
Note: You can use this technique to look at a variety of custom date and time levels by specifying a different DATEPART in the calculation. For example, if you wanted to look at 15-minute increments, you would replace "day" with "minute" in the formula.

Additional Information

To view these steps in action, see the video below. 
Note: the video has no sound. 
Did this article resolve the issue?