KNOWLEDGE BASE

Binning Dates for Custom Date Levels


Published: 13 Apr 2017
Last Modified Date: 13 Apr 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 5-day increments, and are based on the attached packaged workbook UsingCustomDateLevels.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 5 Day Intervals, enter 5 for Size of bins, then click OK. 
  5. Drag 5 Day intervals to Columns.
  6. Drag Arrival Delays to Rows.
  7. Right-click Arrival Delays on Rows and select Measure > Average
  8. Place Destination City 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.
Did this article resolve the issue?