KNOWLEDGE BASE

Creating a Gantt Chart for Small Time Increments


Product(s): Tableau Desktop, Tableau Public
Version(s): All
Last Modified Date: 16 Aug 2016

In Tableau, the Gantt bar mark uses days as the time unit. If your data is in smaller increments, you can use a calculated field to convert the time period so that the data is represented in days.

This article uses the following sample data derived from a manufacturing process.

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.

Step 1: Create a calculated field

  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:

    1. Enter a name for the calculated field. Enter Duration in Days.

    2. In the formula pane, enter (DATEDIFF('second',[Start],[Stop]))/86400


Step 2: Create the Gantt chart

  1. From the Dimensions pane, drag the Start field to the Columns shelf.

  2. On the Columns shelf, right-click the Start field, and then select Exact Date.

  3. Drag the Event field to the Rows shelf and to Color on the Marks card.

  4. On the Marks card drop-down menu, select Gantt Bar.

  5. From the Measures pane, drag the Duration in Days field 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:

    • Under Range, select Fixed.

    • In the Start field, change the start time to 9/27/2007 12:20 AM, and then click Apply.

  8. On the Tick Marks tab of the Edit Axis dialog box, do the following:

    • In the Major Tick Marks section, select Fixed.

    • In the Every field, select or enter 5.

    • In the drop-down list, select Minutes.

    • In the Tick Origin drop-down list, change the origin to 9/27/2007 12:20 AM.

    • In the Minor Tick Marks, select Fixed.

    • In the drop-down list, select Minutes.

    • In the Tick Origin field, change the origin to 9/27/2007 12:20 AM.

  9. (Optional) To edit the colors of the bars, click the drop-down menu on the Event legend card, select  Edit Colors, and then do the following:

    1. From the Select Color Palette drop-down menu, select your preferred color palette. 

    2. Under Select Data Item, select the item you want to assign a different color, and then in the right pane, click the color you want to assign.

    3. Repeat the above step for each item you want to assign a different color.

    4. When finished, click Apply and then OK.

Your finished Gantt chart should look similar to the following.

 

Alternate Search Terms:How To Calculations
Did this article resolve the issue?