# Calculated metrics (for data feeds)

We’re improving the metric creation experience. Our recent redesign lets you preview changes while you create custom and calculated metrics. We’ve also combined raw and modelled data sources into a single object called a data feed.
If you see Data Feeds in the left navigation sidebar, you’ll learn how to add calculated metrics in this article. If not, go here.

Sometimes our instant and custom metrics don’t provide the type of information you’re looking for. When this happens, try creating a calculated metric instead.

Here’s a simple calculated metric example: You have two "Revenue" metrics, one for each of your product lines. Add these two metrics together using the formula `Product A Revenue + Product B Revenue` to create a single calculated metric that displays the "Revenue Total" for both products. See this article for more calculated metric examples.

## What are calculated metrics?

Calculated metrics combine metric values using an equation (with simple math - addition, subtraction, multiplication, and division) to create a metric that can be expressed as a number, a percentage, or a ratio.

Here are some examples of calculated metric formulas:

• Lifetime Value to Cost Of Acquisition Ratio: `ƒ((Customer Lifetime Value)/(Customer Acquisition Cost))`
• True Trials: `ƒ(count(Trial Users that have signed in twice within the first 7 days) / Count(All Trial Users))`

## What do I need to know about Klipfolio calculated metrics?

Here are a few things to note about calculated metrics:

Calculated metrics often combine multiple, individual metrics using a formula. However, you can also enter the same metric more than once in a calculated metric formula, applying different filters to each instance.

There are limits to the number of metrics and nested metrics allowed in a calculated metric formula. If your formula exceeds the maximum number of metrics, you must reassess your formula to reduce them. If your formula exceeds the maximum number of nested metrics, we will indicate which metric(s) needs to be reconfigured. Go here for more details.

When creating a calculated metric, dimensions are selected for you, based on shared, common dimensions from your referenced metrics. If you want to be able to access and filter on specific dimensions and members for your calculated metric, make sure you include the necessary columns in your data feeds and use consistent spelling and naming for each one. For example, if you call a country “United States” in the data feed for one of the referenced metrics and “USA” for the other referenced metric(s), this country category will not be recognized as “shared” and won’t display as a filter choice in your calculated metric.

The aggregation type for a calculated metric is based on the formula and is not configurable.

If a referenced metric is deleted or no longer shared with you, any calculated metrics derived from it will not be able to calculate accurately. You will need to modify the calculated metric’s formula to update it.

Functions in calculated metric formulas are not currently supported.

## Creating a calculated metric

First of all, make sure you have access to the metrics you’ll reference when creating your calculated metric.

Tips:

• After creating a calculated metric, you can use it as a referenced metric for other calculated metrics.

As you create a calculated metric, you:

Enter a formula: The formula structure enables you to perform calculations by inserting operators, grouping with parentheses, and entering constant numerical values, if applicable, for example: (Revenue - Expenses) *2.14. The following operators are supported: +, -, /, *, and ().

Apply filters: As you’re entering your formula, you can optionally apply filters to referenced metrics to include or exclude members for each dimension.

View and, optionally, modify display settings: Choose how you want your calculated metric to display data. Options include giving the metric a custom name, modifying its aggregation type, choosing whether to display metric values cumulatively, applying a different data format, and setting a favourable trend.

See the impact of your selections as a live preview: As you create calculated metrics, you’ll immediately see the effect of your choices as a live preview. Move around inside the UI and experiment with the formula and display settings until you get the result you’re looking for - then save the metric. Note: The live preview uses the “maximum” date range option, which is the overlap of time from the referenced metrics.

Note: The following procedure describes adding a calculated metric from the left navigation sidebar. You can also add calculated metrics from the Metric List page, or from Explorer, or from an open dashboard, in Edit mode.

### To create a calculated metric:

1. In the left navigation sidebar, click the + button beside Metrics and select New calculated metric.
Note: The option to create a calculated metric is only available if you’ve added at least one metric to your account.
2. Write a formula for the calculated metric by entering the names of your referenced metrics, separated by the appropriate operator(s) (+, -, /, *) and including parentheses and constant numerical values, as needed. Continue adding formula components as needed.
Tip: To see a list of all of your metrics and to quickly select and enter them into your formula, click the + button (as shown below). You can also copy and paste entire or partial formulas. Note that the Live Preview pane updates as you build your formula.
3. Click on a referenced metric, where, under Data, you can see (and modify) its aggregation type and see (and modify) its use of cumulative values.
Note: These settings are not editable for instant metrics or for custom metrics that have the option to override default aggregation disabled. 4. To apply filters, click on a referenced metric, where, under Filter, you can select which members to include or exclude for each dimension. When you’re done, click Filter. 5. Under Format, choose from Numeric, Currency, Percentage, or Duration. If you selected Currency as the data format, the default currency symbol that will display is USD \$. You can select an alternate Currency symbol from the drop-down list. Note: This is a display option only. Currency is not converted.
6. Under Favourable trend, optionally, choose whether you want ascending or descending values to indicate a positive trend. For example, if your metric includes sales totals, a higher (ascending) number demonstrates a positive trend but, if your metric includes cost to acquire customers, a lower (descending) number indicates a positive trend. Favourable trends are indicated by a green arrow. Note: This option is not applicable to all visualization types. 8. Under Name, type a new name for your calculated metric or use the name that was automatically applied based on the referenced metrics.
9. Optionally, enter a description for the calculated metric.
11. Click Save metric.
The calculated metric opens and it’s added to your Metric List page.

### Understanding calculated metric limits

When creating calculated metrics, keep in mind that each calculated metric can include up to 5 unique metrics and up to 3 levels deep of nested metrics. See below for a visual representation of these limits: ## Editing a calculated metric

After creating a calculated metric, you can edit it to modify its formula and display settings.

### To edit a calculated metric:

1. In the left navigation sidebar, click Metrics to open the Metric List page.
2. Select the calculated metric you want to edit from the list.
3. Click the Edit button in the top navigation bar.
4. Modify the formula by adding or removing metrics and entering appropriate operators.
5. Modify the aggregation type and the use of cumulative values by clicking on a referenced metric in the formula and opening the Data tab.
Note: These settings are not editable for instant metrics or for custom metrics that have the option to override default aggregation disabled.
6. Modify filters by clicking on a referenced metric in the formula and opening the Filter tab. Select which members to include or exclude for each dimension. When you’re done, click Filter.
7. Under Format, choose a different format type.
8. Under Favourable trend, modify the trend settings.