Google Data Studio: An Introduction to Custom Defined Calculated Fields

Google Data Studio allows you to create customized calculated fields to endlessly manipulate data in reports.

Google has released Google Data Studio, a powerful tool for combining data from different sources with endless options for visualizing and manipulating data in reports.

In this post, I explain how to create customized calculated fields that can be used in Data Studio reports.  Calculated fields appear as objects in the data source, and can be added to charts, filters and controls in the report interface. A calculated field can even be used as a formula reference in another calculated field.

Calculated Fields

Calculated fields accept functions with operators that can perform math, logical comparison, text handling, and other arguments to perform a desired action. For a list of valid functions, refer to Google documentation on valid function syntax

An example of a formula to create a single line entry of a Browser, its version, and a version number appears like this:

CONCAT(‘Browser:’, Browser, ‘Version:’, Version-number)

Return Data Type

The type of data return in a calculated fields results is dependent on the type of function used. A text function will usually return text, where math and aggregation functions will return a numerical value.

Dimensions and Metrics

Whether the Custom Field you create can be used as a dimension or a metric in reports will depend on what kind of value is returned in the formula. If the formula returns a text or date value, it will be considered a dimension. A numerical result will be available as a metric. In Data Studio, the field names are color coded as Green for a dimension and Blue for a metric when viewing the complete fields list.

More on dimension and metrics syntax

Define the Logic of a Custom Dimension or Metric

For this post example, I would like to know how I am doing at converting users, regardless of how many sessions that user had. By default, Google Analytics calculates a conversion based on the goal completions and number of unique sessions. But because I want a conversion metric based on users instead of sessions, I create a custom formula to calculate the count of completions on number of users.

This formula uses a Goal Completion value of a goal I have already defined in Google Analytics.

Editing the Data Source

At the top of the table, you can add a Custom Field Name, which will correlate into a custom dimension or metric you can refer to in your Data Studio reports.

Adding the custom defined value to the data source will allow me to reference my created metric in reports. Note my formula contains two metrics, and will be returned as a metric value.

Author: Peter

Peter

Peter holds a Google Analytics Individual Qualification (GAIQ) and Google Tag Manager certification. He has 10+ years of experience with Marketing analytics in organizations and websites of all sizes. When he isn't building BI dashboards he chases his daughters around Portland Oregon.

Leave a Reply

Your email address will not be published.