Creating a Gantt Chart with Overlaying Shapes for Small Time Increments

Published: 16 Mar 2017
Last Modified Date: 20 Jul 2023


How to create a Gantt Chart with shapes for a data that uses smaller increments.


Tableau Desktop


In Tableau, the Gantt bar mark uses days as the time unit by default. Therefore you will need to use a calculated field to convert the time period so that the data is represented in days. This example can be reviewed in the attached workbook, the sample data is derived from a manufacturing process.
Step 1: Create a Calculated Field
To make an accurate Gantt chart in Tableau, you must consider the granularity of the data you are displaying. In this case, you need the resolution in seconds. You use the DATEDIFF function in a calculated field to determine the interval between the Start and Stop. While the example uses seconds for the date part, you could use hours or minutes
  1. Connect to your data source. This example uses the attached data source.
  2. Select Analysis > Create Calculated Field.
  3. In the dialog box, do the following and click OK:
    1. Name the calculated field: Duration in Days.
    2. In the formula pane, enter (DATEDIFF('second',[Start],[Stop]))/86400
    3. Note: the above formula is based on the data source fields. Your data source's start and stop fields will be named differently. 
Step 2: Build the View
  1. Drag "Start" to the Columns shelf.
  2. On the Columns shelf, right-click the "Start" field, and then select Exact Date.
  3. Drag "Event" to the Rows shelf and to Color on the Marks card.
  4. If it is not set by default, select Gantt Bar on the Marks card drop-down menu
  5. Drag "Duration in Days" to Size.
  6. Right-click the x-axis, and then select Edit Axis.
  7. On the General tab of the Edit Axis dialog box, do the following:
    1. Under Range, select Fixed.
    2. In the Start field, change the start time to 16/03/2017 08:00:00, and then click Apply.
  8. On the Tick Marks tab of the Edit Axis dialog box, do the following:
    1. In the Major Tick Marks section, select Fixed.
    2. In the Every field, select or enter 5.
    3. In the drop-down list, select Minutes.
  9. In the Tick Origin drop-down list, change the origin to 16/03/2017 08:00:00.
    1. In the Minor Tick Marks, select Fixed.
    2. In the drop-down list, select Minutes.
    3. In the Tick Origin field, change the origin to 16/03/2017 08:00:00.
  10. (Optional) Edit the colors as desired.
Step 3: Add Shapes
  1. Reproduce all the steps from Step 2: Build the view
  2. In the "Start (2)" card change the type from Gantt Bar to Shape.
  3. Remove "Sum(Duration in Days)" from Size.  
  4. Drag "Event" to Shape.
  5. (Optional) Modify the shapes and the colors as desired.
  6. Right-click the second "Start" field and select Dual Axis.
  7. Right-click the top header and select Synchronize Axis.
  8. In the "Start" card click the color option and lower the Transparency to 50%.

Additional Information

To view the above steps in action, see the video below: 

Did this article resolve the issue?