Sub topic 7
What timelines are and when to use them
This chapter assumes you can build a basic PivotTable, know the difference between text and true date values in a cell, and can find contextual ribbon tabs. Insertion steps, date-field preparation, and time-level navigation each get their own chapter. Here you build the working model and learn when a timeline is the right tool.
What a timeline is
A timeline is a filter control made for dates. It shows a horizontal bar of time periods with a scroll bar underneath. You click or drag across the bar to choose a period, and the connected PivotTable shows only the rows that fall inside it.
A timeline is like a slicer in that it sits on the worksheet, shows the current filter at a glance, and can be connected to several PivotTables. It differs in what it filters. A slicer lists the distinct items of any field as buttons. A timeline reads one date field and lays the dates out on a calendar scale.
Timelines are available in Excel 2013 and later. They work only with PivotTables, not with plain ranges or Excel Tables.
How a timeline filters
When you select a period, the timeline applies a date-range filter to its source field. The range is always continuous. You choose a start and an end, and everything between them is included.
The control has four time levels:
- Years
- Quarters
- Months
- Days
The level sets how coarse each block on the bar is. At the Months level, one click selects one month. Dragging the handles at either end of the selection stretches it across several months. The level changes only the block size. It does not change the underlying data.
A timeline is tied to a single date field. If your data has both an order date and a ship date, you need one timeline per field.
Timeline or slicer
The main trade-off is flexibility against convenience for dates.
| Need | Slicer | Timeline |
|---|---|---|
| Filter by category, such as Region | Yes | No |
| Pick non-adjacent items, such as January and March | Yes | No |
| Pick a continuous date range | Awkward | Yes |
| Switch between years, quarters, months, and days | No | Yes |
| Needs a true date field | No | Yes |
You could build a "Month" slicer, but it lists month names as separate buttons. You would have to Ctrl-click each month, and you would not get a scrollable, zoomable calendar scale. For a continuous range, such as "March through August of last year", a timeline is faster and harder to get wrong.
If you need to compare non-adjacent periods, such as the same quarter in two different years, a timeline cannot do it. Use a slicer on a Year or Quarter field instead.
Requirements and limits
- The field must hold real dates. Text that only looks like a date will not work. The next chapter covers how to prepare the field.
- A timeline filters by one date field per control.
- Several PivotTables can share one timeline only if they use the same pivot cache.
Exercise
A PivotTable shows sales by product. You want readers to compare Q1 and Q3 of the same year in one view. Can a timeline do this? If not, what would you use?
Show answer
No. A timeline selects only one continuous range, and Q1 and Q3 are not adjacent. Use a slicer on a Quarter or Month field instead, and Ctrl-click Q1 and Q3 to select both.