1 Introduction

This session, we’ll learn advanced filtering techniques in Google Data Studio.

Filtering is the “process of choosing a smaller part of your data set” to view or analyze (Facer, 2018).

In short, we’ll explore the following filtering techniques:

  • Chart-Level Filters: Customize an individual chart to show only the data you want to visualize.
  • Page-Level Filters: Individualize each dashboard page by filtering data for the entire page.
  • Report-Level Filters: Filter all data for every page, chart, and table in your report.
  • Filter Controls: Let you viewers control the parameters with which to filter.

Our practice data will be comprised of quantitative, qualitative, datetime, and geospatial variables.


Motivating Example: Filtering with Date Ranges

You may want to view specific data from a certain time period. Pictured above is a user-controlled date range filter.


1.1 Review

Last session, we explored the following techniques:

  • Data Tables, which provide data at higher resolutions than visualizations
  • Score Cards, which highlight key performance indicators to keep an eye on
  • Transformations, which create new data from existing variables

You can view the last session script here, as well as all session scripts here.


Using Data Tables & Transformations to Create Sophisticated Reports

Nearly every datum pictured above is comprised of a table with transformed variables.


2 Practice Data

This session, we’ll use practice data from the NYS Office of Parks, Recreation, and Historic Preservation.

Our practice datasets include data on state parks in Central New York:

These datasets have been combined into a single document for convenience. View preprocessing tasks here.


2.1 Dataset Variables

Dataset variables or fields include the following:

  • Year: Year when cumulative park attendance was recorded
  • Facility: Name of the state park
  • Category: Indicates whether record is a state park, historic site, or marine facility
  • Region: Region ID per Office of Parks, Recreation, and Historic Preservation
  • County: New York State County name
  • Attendance: Cumulative attendance for Facility in Year
  • Golf: Indicates golfing facilities
  • Camp: Indicates camping facilities
  • Playground: Indicates playground facilities
  • Facility URL: State park website address
  • Longitude: Longitudinal value of state park location
  • Latitude: Latitudinal value of state park location
  • Location: Paired Latitude and Longitude coordinates of park location


2.2 Accessing the Data

You may access the practice data in Google Sheets, located here.


3 Understanding “Levels”

Levels designate the “scope” of each element in your report. There are three main levels:

  • Report-Level filters affect all data in the report; visual elements appear on every page in the report
  • Page-Level filters affect all data on the page; visual elements appear only on that page
  • Chart-Level filters affect only data in a given chart or graph


3.1 Report-Level Elements

To make an element Report-Level in Data Studio:

  • Right-click the element when in “Edit” mode
  • Select “Make report-level”

Notably, visual elements exist in the same place on every page in your report.

Alternatively, report-level filter controls will affect all data in your report.


Designating Text as Report-Level

Report-level visual elements will exist in the same place and in the same format on every page.


Observe:


“Report Page 1” & “Report Page 2” Featuring the Same Report-Level Header


Regardless of page, visual elements remain in the same position and format.


3.2 Report-Level: Hiding Elements

Not all Report-Level elements are desireable on every page.

This is especially true for Filters. In this case:

  • Select “Insert” from the menu
  • Select “Rectangle” from the dropdown
  • In “Rectangle Properties”, set “Background” to white
  • Click-and-drag the rectangle over an element to hide it


Hiding a Report-Level Filter with a White Rectangle

Since report-level filters appear on every page, you may want a page without it. Here’s how!


Demonstration: The Global Literacy Assessment Dashboard (GLAD) features a number of Page-Level Filters, while the first two pages feature a Report-Level Filter. This report-level element is hidden on the “Glossary of Terms” and “Contributors” page by using this technique.


3.3 Page-Level Elements

By default, visual elements and filters are set to Page-Level.

Page-Level Filters only filter data visualized in charts and organized in tables on the page where it’s placed.

Page-Level Visual Elements like images and shapes are also page-specific and will not appear on other pages.

To ensure an element is Page-Level in Data Studio:

  • Right-click the element when in “Edit” mode
  • Select “Make page-level”


Designating Text as Page-Level

Designating an element as page-level ensures it may only be found, or affect filtering, on that page.


3.4 Chart-Level Conditions

Chart-Level designations are reserved specifically for data tables and visualizations.

To create a Chart-Level Filter, you must:

  • Create a chart, map, or data table
  • In the “Data” tab, select “ADD A FILTER”
  • Name your filter (for use future use)
  • Specify the filtering condition(s)
  • Click “Save”

We’ll explore how to filter based on specified conditions below.

Note: Chart-level filters may be used more than once in the Filter Picker menu.


Selecting “Add New Filter” in the “Data” Tab

Simply click “Add New Filter” to create a filter specific to that chart.


The “Create Filter” Interface

You can specify up to 75 filtering conditions at the chart-level.


4 Date Range Filters

Date Range Filters are simple to implement and use, and my be applied at Report-, Page-, and Chart-Level.

  • You must have a Date/Time variable in your data source
  • To function, you must insert a datetime variable in “Date Range Dimension” in the “Data” tab
  • Unit of measurement, e.g. “Year” (YYYY) or “Date” (YYYY-MM-DD), dictates the type of filter you use
  • If using units, e.g. “Year”, use a Filter Control
  • If using dates, e.g. “2019-08-02”, use a Date Range

Make sure you select the right control in the “Insert” dropdown from the main menu!


Inserting a Date Range Filter

Simply click “Date range” from the “Insert” menu and select where to place your control.


Designating a Variable as the “Date Range Dimension”

Click-and-drag your datetime variable in the “Date Range Dimension” to filter by date.


Selecting Date Ranges by Date (e.g. January 1, 2008 - December 31, 2014)

Use a “Date Range” filter if your datetime variable contains months and days.


Selecting Date Ranges by Units of Time (e.g. 2013-2018)

If selecting units of time, filter date ranges using a standard “Filter Control”.


4.1 Date Range Resources

You can visit Google Data Studio’s Help Documentation to learn more about the nuances of Rate Range Filters.


5 Filter Controls

Filter Controls allow your audience to define their own filtering parameters.

  • Virtually any categorical variable (e.g. “County” or “Facility”) is ideal for a Filter Control
  • Quantitative variables, e.g. “Attendance”, can be discretized into categories for filtering
  • Special options exist which allow filtering by pattern matching and other advanced methods

To create a Filter Control:

  • Click “Insert” in the Data Studio Menu
  • Select “Filter control”
  • Place on canvas


Selecting “Filter Control” from the “Insert” Dropdown

Simply click “Insert” and select “Filter Control” to insert a user-controlled filter.


A Searchable, “Fixed Size” Filter Control

“Fixed Size” filter controls create a scrollable list that always remains open.


A Searchable, “Pop-Up Menu” Filter Conrol

“Pop-Up Menu” filter controls provide more real estate in your report and help the signal-to-noise ratio.


5.1 Search All Filters

Rather than choosing from a List Filter of categories, Search All Filters search data for patterns.

  • Create a Filter Control
  • Select the "Style tab
  • Click “Search All”

This will modify your filter to Search All. These allow you to search by:

  • Equals shows values exactly equal to an entered value
  • Contains shows values containing the pattern of characters entered
  • Starts With shows values that begin with the pattern of characters entered
  • Regexp uses regular expressions, or “regex”, to show values matching sophisticated patterns
  • In filters by one or more values, exactly written, in a variable - and are separated by commas


Comparison of “List” and “Search All” Options in the “Style” Tab

The option to change from “List” (checkboxes) to “Search All” (written fields) is in the “Style” tab.


A “Search All” Filter Control with Available Options

*“Search All” filters aren’t immediately intuitive to many users, but they’re very powerful when used properly.


5.2 Filter Control Resources

You can visit Google Data Studio’s Help Documentation to learn more about the nuances of Filter Controls. Specifically:

  • How to Create, Edit, and Manage Filters (View)
  • How to Configure Filter Conditions (View)
  • Filter Examples (View)


6 Chart-Level Filters

Chart-Level Filters include or exclude data for a single table or chart based on your conditions, not end users.

  • Select a chart, table, or other dynamic report element
  • In the “Data” tab, click “Add a Filter” in the “Filter” section
  • Select an existing filter or click “Create a Filter”
  • Name your filter for recognition and future use
  • Enter conditions on which to filter (up to 75)
  • Save your new filter

Note: More than one chart-level filter may be applied to a single chart or table.


Selecting “Add a Filter” in the “Filter” Section of the “Data” Tab

Not only can you create new filters in this section, applied filters will be displayed here, too.


Creating & Editing a New Filter

This filter has a single conditional clause that’s inclusive of all state parks located in Onondaga County.


Creating Filters with Multiple Conditions

With the “And” and “Or” options, you can create extremely sophisticated filters with multiple conditional clauses.


6.1 Conditional Clauses

Conditional Statements are also called Logical Statements, as each record must be evaluated as True or False.

  • Each statement comprises a Clause, and each filter can have up to 75 Clauses
  • Clauses are joined with logical operators And and Or
    • And indicates that all conditions in the clause must be True
    • Or indicates that at least one condition in the clause must be True
  • Clauses are inclusive (“Include”) or exclusive (“Exclude”)

Qualitative Variables will have operators that relate to sets (e.g. “In”) or pattern matching (e.g. “Contains”).

Quantitative Variables will have comparators like “Greater Than” (>), “Less Than” (<), etc.

Note: These may be as simple or sophisticated as you choose!


7 Applied Practice

Overview: A report has been prepared for you using the NYS OPRHP’s State Park Attendance Data.

  • Access the report by opening a new tab using this link
  • In the upper-right, click “Make a copy of this report” (Help)
  • If you need to connect a data source, you can create a copy of the “CNY State Parks” Google Sheet


The “State Parks in Central New York” Practice Dashboard

The upper-left corner has been reserved for creating and placing new filters.


Instructions: Create the filters based on the specifications below and place them in the designated areas.

  1. Create a “Search All” control filter for variable “Facilities”
  2. Create a “List” control filter for variable “County”
  3. Create a “List” control filter for variable “Year”
  4. Create 3 “List” control filters for variables “Golf”, “Camp”, and “Playgound”
  5. Select “Annual park attendance by year” and create a chart-level filter to exclude the longest category name