Calculated Metrics are user-defined metrics that are computed from existing metrics and drive more relevant analyses and enable greater actionability without leaving the product.
In this article:Creating calculated metrics
To create a new calculated metric in Analytics follow these steps:
- Sign in to Google Analytics..
- Click Admin, and navigate to the view you want.
- In the VIEW column, click Calculated Metrics > NEW CALCULATED METRIC
You'll then see the Add Calculated Metric interface:
To create a calculated metric you need to populate the following fields and click the Create button when finished.
- Name – Provide a descriptive name (i.e. "Average Order Value"). This will appear in the Metric selector for custom reports.
- External Name – Automatically populated based on the value entered in the Name field and should not be modified. It can be changed from the recommendation during creation but it cannot be changed after it is created. The External Name value must be unique.
- Formatting Type:
- Integer (with customizable decimal places)
- Currency (Decimal)
- Time
- Float
- Percentage (with customizable decimal places)
- Formula – Start typing and you'll see a list of predefined metrics which you can use to create a formula. Accepted operators include:
- Plus (+)
- Minus (-)
- Divided by (/)
- Multiplied by (*)
- Parenthesis
- Positive cardinal numbers (0-9), can include decimals
Note: Using another custom calculated metric in the creation of a new calculated metric isn't supported.
Using the Formula field and input examples
The Formula field provides a quick way to create and modify formulas using the following inputs:
- Standard metrics – (e.g. Total Events, Unique Visitors)
- Custom metrics – (e.g. Number of members, scores, awards, or points)
- Constants – (e.g. 1.31*Revenue for currency conversion from USD to EUR)
Best practice is to add .0 to whole numbers, e.g., 13.0.
Note: Combining currency and non-currency values in the Formula field is not supported and may lead to unexpected results.
Using calculated metrics
Once created, calculated metrics are available at query-time in the following locations:
- Custom reports
- Custom Dashboards and widgets
- Analytics reporting APIs
Note: In order to access a calculated metric via API, all constituent metrics must also be available by API.
Use cases
Example 1: Revenue Per User
- Name: Revenue Per User
- External Name: (automatically populated)
- Formatting Type: Currency (Decimal)
- Formula: {{Revenue}} / {{Users}}
Example 2: Currency conversion
- Name: Revenue from GBP to EUR
- External Name: (automatically populated)
- Formatting Type: Currency (Decimal)
- Formula: {{Revenue}} * 1.27
Related resources
- Understand the building blocks of your reports, Dimensions and metrics
- About custom dimensions & metrics
- Setting up custom dimensions and metrics in your account
Developer resources
Use the environment-specific instructions in our Developer Guides to set up calculated metrics.
- Website tracking: For Universal Analytics (the gtag.js JavaScript library)
- Mobile app tracking: For Android and iOS mobile apps
- Reporting APIs