As the name suggests, timeline chart in Tableau represents when the notable events are going to occur in the month, year, or even day. Also, the timeline can be used as a calendar showing upcoming dates of interest. Learn Tableau for Data Science
In this article, I am going to mention the steps that required to timeline chart in a Tableau.
Our objective is to build the timeline chart that can be used as a calendar showing upcoming dates of interest. The timeline chart will look like this:
To create this type of chart, we need to have data in the specific format. In this is a case I am going to use the data structure as below which is designed specifically for this task.
As per the objective of building timeline chart, the following fields are needed in the dataset:
- Date: This field provides the dates on which events are going to take place
- Events: This field provides the brief description of the events across dates
Following are the steps:
- Connect to your data source. For reference, you can recreate the data in the previous image.
- Go to Sheet1:
- 3. Before we start to build the chart, we need to create the following calculations :
- Now, drag the “Date” field to “Columns” and “Default Min” field to “Rows” shelf
- Convert “Date” field to “Continuous”
- Next, make the “Date” field as discrete by selecting “Exact Date” option to show all the date values
- Drag “Events” fields to “Detail” marks card and change the type of the chart from ‘Automatic” to “Shapes”
- In the next step, we need to filter out the dates where there are no events scheduled. To apply a filter, drag “Events” fields to “Filter” shelf and select as shown in the snapshot:
- Since some of the dates have passed, and because most events are not scheduled more than a few months in advance, we will add a relative date filter to only show the next 90 days.
To do so, drag the Date dimension to the Filters Shelf and choose “Relative Date”.
This is how the chart looks like after applying the filter:
- Next, we need to add today’s date as a reference line. To add reference line, select the x-axis and do a right click over it
- In the “Reference Line” window, make the selection as shown in the snapshot
This is how the chart looks like after adding reference line:
- To make the chart visually more appealing, we can do the following mentioned formatting changes:
- we can format the “zero lines” on the view to give the timeline itself a customized look
- hide the “Default Min” header by right-clicking the Y-Axis and deselecting “Show Header”
- Increase the size of the dots, and drag the fields as follows:
+ “Events” field in “Color” card
+ “Date” field in “Label” marks card
+ “Events” field in “Label” card
- Finally, the timeline chart looks like this: