Search
Clear search
Close search
Google apps
Main menu

Work with dates and time

Understand how to use time-based data in your reports and data sources.

Data Studio gives you a number of tools for working with date and time-based information. Most chart types can be broken down by a date dimension. You can set default date ranges for your reports, and you can include a customizable calendar widget so viewers can control the timeframe. And you can use calculated fields to manipulate and transform your time-based data in useful ways.

In this article:

Dates in reports, data sources, and your data set

To better understand working with date-based data in Data Studio, it helps to know the following:

Date data comes from your data set. Data Studio has no way of applying date ranges to your reports on its own.

Date data needs to be in a format Data Studio can understand. See How Data Studio handles dates below.

The date and time units available for visualization depend on the date dimensions in your data source. For example, in order to show sales by calendar quarter, you'll want to have a "Quarter" or "Year Quarter" dimension in the data source. See Date display options below.

You control the timeframe of your charts by editing the date range properties in your reports.

Visualize date-based data

The simplest way to visualize date-based data is to use a time series chart. A time series plots your data using the selected date dimension as the X-axis, letting you see how that data changes over time. You can also use bar charts, area charts, and scatter charts to visualize date dimensions.

See the chart reference.

Compare to previous period Date comparison icon

Some charts, such as the time series, scorecard, and table, can compares one date range to another. You can compare the current range to the previous matching period (e.g., compare this week to last week), or to the current date range in the previous year (e.g., a calendar week this year to the same calendar week last year). Data Studio automatically colors positive and negative changes. You can set these colors using the STYLE tab for the selected chart.

Examples of date comparisons

Change the default date range

The default date range for your charts and controls depends on their data source. For example, charts based on Google Analytics data show the last 28 days' worth of data by default. Charts based on Google Sheets show all the data in the sheet. You can change the amount of data shown by setting the Default Date Range property. You can set this property for your entire report, specific page, or for one or more charts and controls on a page.

Show me how to set the Default Date Range property

To change the default date range for the entire report, edit that report and select the File > Report settings menu

To change the default date range for a specific page, edit that page and select the Page > Current page settings menu

To change the default date range for a single chart or control, select it

To change the default date range for a group of charts, select them

Next:

  1. In the Properties panel on the right, select the DATA tab
  2. Scroll down to find the Default Date Range property
  3. Select Custom
  4. Click the currently selected range to display the date range options

Date range options Calendar icon

You can use the calendar widget to define either a fixed date range, or a rolling date window.

Fixed date ranges let you set beginning and ending dates. Your chart will always show that specific time frame.

To set a rolling date window, select one of the predefined options, such as "Last week" or "Last month." Rolling date ranges are relative to "today."

Use the Include today check box to include any data collected so far for the current day (if applicable).
Data Studio defaults to starting the weekly rolling window on Sunday. You can change this to start on Monday by selecting This week (starts Monday) or Last week (starts Monday) in the date options list.

Let viewers change the date Date range control icon

You can enable your viewers to adjust the date range by placing a date range control on the report.

Learn more about date range controls.

Set the Date Range Dimension

The Date Range Dimension is the dimension that contains your date data. This is the dimension Data Studio will use to constrain the timeframe of a chart, control, page, or report.

Google Analytics components automatically use the ga:date dimension as the Date Range Dimension. For other data source types, Data Studio does its best to determine the dimension to use. You'll only need to set this manually when Data Studio cannot find a valid date dimension, or if your data source contains a different dimension you want to use.

The dimension you use as the Date Range Dimension must formatted as Date YYYYMMDD.

 

Show me how to set the Date Range Dimension for a chart
  1. Select the chart
  2. Select the DATA tab
  3. In the Data Source section, click the Date Range Dimension chip, then use the dimension picker to select a valid time dimension

The Date Range Dimension can also be set at the report or page level using the File > Report settings menu or the Page > Current page settings menu.

How Data Studio handles dates

Data Studio's internal time format is YYYYMMDD[HH:MM:SS]. The data in your underlying data set can be in other formats, as long as Data Studio can convert that into the internal time format.

Data Studio assumes all datetime data is in UTC standard time. If that is not the case for your data set, you may see discrepancies when charting data for the current day (due to differences between UTC and your timezone).
You can convert a datetime filed to UTC using the TODATE function.

Date formats

You can change the way dates and times are displayed in a chart by editing the data source for that chart. Use the Type drop-down menu for your date field to select the desired Date & Time format.

Example

Let's say you've got a spreadsheet of daily sales figures, and you'd like to display that data on a yearly basis. In Google Sheets, the dates should be entered as YYYYMMDD (you can use the Format > Number > Date menu options to display the data the way you like).

Create a data source Data Studio based on that worksheet. Set the Type for that date field to a Date & Time > YEAR (YYYY).

Example of changing the semantic date type

Show me the list of date formats

Format Example

Date Hour (YYYYMMDDHH)

Aug 23, 2016, 6PM

Date (YYYYMMDD)

Aug 23, 2016

Year Month (YYYYMM)

Aug 2016

ISO Year Week (YYYYww)

Aug 23, 2016*

Day of Week (D)

Tuesday

Year (YYYY)

2016

Month (MM)

August

ISO Week (Www)

Week 35

Day (DD)

23

Hour (HH)

6PM

Minute (mm)

52

Month Day (MMDD)

Aug 23

Quarter (Q)

Q3

Year Quarter (QYYYY)

Q3 2016

* ISO Year Week shows the range and week number on your charts as a mouse-over data point tip, rather than as an axis label.

Extract and manipulate date in calculated fields

You can use calculated fields to extract and manipulate date data in your data source. For example, you can create a field to display the calendar quarter or day of the week. These fields can then be used in your charts and controls to segment your data by different date parts. You can also convert the dates from one format to another. For example:

TODATE(Date, 'DEFAULT_DASH')
Outputs a date using dashes as a separator. E.g. 2016-11-28. The TODATE function also converts dates to UTC standard time.
Was this article helpful?
How can we improve it?
What's new in Data Studio

Learn about new features and recent changes.