Why You Should Create Custom Calculated Metrics in Google Data Studio

If you are like me and use Google Data Studio on a regular basis, you probably have noticed some discrepancies between the data pulled from the API and what is displayed in the native platform interface, i.e. Google Analytics or Google Ads.

One of these such discrepancies resulted in us creating Custom Calculated Metrics for use with Google Data Studio reports and dashboards. This allowed for a more accurate reporting analysis, as well as the flexibility to combine and group dimensions without creating errors in the API calls.

What are Custom Calculated Metrics?

A Custom Calculated Metric is a copy of a pre-set calculated metric that comes with the API by default. We define this metric using the same basic formula, but give ourselves more flexibility when using them with different combinations of custom dimensions and reports.

Simply put, instead of relying on the pre-set Click Through Rate (CTR) metric that comes from the API, we will create our own. In Data Studio, we create a Custom Metric with the same formula as the pre-set version, and call it the “Calculated Click Through Rate.”

Why Do I Need to Use Custom Calculated Metrics?

One thing we noticed during our quality assurance testing of our reports were discrepancies in some of the calculated metrics that come as part of the API. Not only were there differences in the numbers being reported in the API and in the native interface, but we were also seeing some of the numbers calculated incorrectly.

Why Doesn’t My Cost per Conversion Metric Calculate Correctly in Google Ads?

As you can see in the example below, the Google Ads interface is showing our Cost per Conversion as $128.91.

costs-per-conversions-example

The problem is, $25,121.60 / 191.04 does not equal $128.91. It is actually $131.50. While the numbers are close, they are not the same and the difference could cause issues depending on your operating parameters (ROAS, Target goals, etc.).

This led us to start creating Custom Calculated Metrics in our Data Sources for use in Data Studio.

How Do I Create a Custom Calculated Metric?

In order to create a custom metric, we need to edit our data connector.

  1. Edit your report by clicking the edit button in the top right corner of the page.
  2. Click on any table or chart on the page for the metric you are trying to create.
  3. Click on the pencil icon to the left of the data source on the right side menu area that opens after clicking on the table or chart.
    a. If you do not see the pencil icon, you probably don’t have admin access to the data connector with your current login. Use an account that has admin access in order to edit the data connector.
  4. Click the “Add a Field” button in the top right corner of this new area. The button is directly below the blue “Done” button.
  5. Click the Field Name text input and name your metric accordingly.
    a. For this example, we are naming it “Calculated Click Through Rate”
    b. Be sure to choose a descriptive name so you can differentiate between the auto-generated metric and your new calculated metric.
  6. In the Formula area, you want to type out the metric names and formula as you would calculate them by hand.
    a. For our example, we type: “Clicks / Impressions”
    b. You will notice that metric names are suggested as you type. It is helpful that you can click on them to insert them into the formula. Be mindful that selecting a metric from the list does not always work. You can also add metrics by searching for them in the left side “Available Fields” area.calculated-metrics-formula
  7. Click the “Save” button.
  8. Make sure to update your new metric’s field type accordingly. For our example, we would choose Number → Percent. Keep in mind you can edit the name of this metric for any table or chart to make it more visibly appealing for your reports.updated-metric-type-data-studio
  9. Click the blue “Done” button in the top right corner to close the data connector.

We can now use this calculated metric in any of our reports to get a more accurate Click Through Rate. If you ever see metrics in the API, Data Studio, or native platform interface that are not calculating properly, consider using Calculated Custom Metrics within Google Data Studio to get a more accurate representation of your data.