Date transformations and visualizations

Time Series Analysis in Tableau

Chris Hui

VP, Tracked

Date time specific data types

Tableau treats date time data in a unique way:

  • Date data is returned as either a date or date-time format

Color based markers indicate data type:

  • Blue icons indicate discrete data
  • Green icons indicate continuous data

Time Series Analysis in Tableau

Date time data models

  • Date time data can be provided in a date dimension format

  • Each dimension of the date field is split into its smallest measure

  • To deal with date data in this format, you can use the MAKEDATE() function to reconstruct a singular date field

Table of date time values organized by minutes, hours and seconds showing a fact dimension data model structure

Time Series Analysis in Tableau

Making dates in Tableau

  • MAKEDATE() is a date formatting function that enables reconstruction of date time objects from separate date time fields

  • MAKEDATE() assumes the dates provided are valid and does not have any inbuilt validation

Tableau calculated field showing the make date time function requiring the year, month and day

Time Series Analysis in Tableau

Making time in Tableau

  • If you need to add a time component to your date field, you need to use MAKEDATETIME()

  • Time needed? = MAKEDATETIME()

  • Date only? = MAKEDATE()

Tableau calculated field showing the date and time arguments required for the make time function

Tableau calculated field showing the make date time function requiring the year, month and day

Time Series Analysis in Tableau

Date truncation in Tableau

  • DATETRUNC() rounds your date field to the desired specificity
  • DATETRUNC() returns the lowest value for each date part up to the date part specified as a date time object

Tableau calculated field showing how the date truncation functions work to return weekly data only

  • Useful for date preparation to showcase how measures changes over discrete time periods (e.g. Week on Week Growth)

Bar chart showing the weekly number of bike rides occurring for each week starting the 1st November, 2021 to the 6th December, 2021

Time Series Analysis in Tableau

Calculations between date timestamps

  • Dates can be subtracted using the syntax of Date2 - Date1, however, the result returned is in days
  • This is not desirable as valuable time series information would be lost due to rounding

Tableau calculated field showing the difference between subtracting two date fields manually

  • DATEDIFF() returns the amount of time between two time stamps based off the specificity provided (e.g. 'minute','hour' etc.)
  • Best practice returns data at the lowest granularity needed where the results are adjusted as required

Tableau calculated field showing the difference using DATEDIFF and how this returns the exact amount of time elapsed beween two date fields

Time Series Analysis in Tableau

Visualizations with time series

Bar charts An image showing what a bar chart looks like

Area charts An image showing what an area chart looks like

Cumulative distributions An image showing what a cumulative distibution bar chart looks like

Line charts An image showing a simple time series line chart

Time Series Analysis in Tableau

Let's practice!

Time Series Analysis in Tableau

Preparing Video For Download...