# Calculated metrics (for data sources)

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, go to this article to create calculated metrics.
These new features are being released gradually. If you don't see them in your account yet - no worries - they’re coming soon!

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 modelled data sources and use consistent spelling and naming for each one. For example, if you call a country “United States” in the modelled data source 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

As a first step, ensure you have access to the metrics you will reference when creating your calculated metric.

Notes:

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

Within the calculated metric configuration wizard, you have the option of moving forward and back, so it’s easy to play with your formula and settings until you get the end result you’re looking for. For additional clarity, as you create your calculated metric, the Preview pane displays the results of your choices. (Note that the metric value in the Preview pane uses the "maximum" date range setting, which is the overlap of time from the referenced metrics.)

During the calculated metric creation process, 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.
• Choose display settings: This is where you give your calculated metric a name and choose how you want it to display. We recommend choosing a relevant, descriptive name, ideally including the typical terminology for the metric you want to create, for example, “Page Views per Session”. In the Display settings window, you can also set a favourable trend, choose a format type (numeric, currency, duration, or percentage), and choose whether or not to show your data cumulatively.

### To create a calculated metric:

1. In the left navigation sidebar, click the + button beside Metrics.
Note: You can also add a calculated metric from the Metric List page or from an open dashboard, in Edit mode.
2. Click Calculate a new metric.
3. On the Create a calculated metric page, in the Formula window, write your formula 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 required.
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 right-hand Preview pane updates as you build your formula.
4. Click on the referenced metric to see its aggregation type. The aggregation type is chosen for you based on the referenced metric’s aggregation type, but you can modify this setting if required. 5. If you want to apply filters, click on the referenced metric and, under Filter, select the members to filter for each dimension. Next, select either Include or Exclude, and click Filter. 6. When you’re done building your formula, click Next.
7. In the Display settings window, under Metric name, type a name for your calculated metric.
You can also name your metric in the Preview pane.
8. Under Format, choose a data format type from the drop-down menu: 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.
9. Optionally, set your data to Show as cumulative.
10. Optionally, set a Favourable trend for your calculated metric.
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. This option only applies to scorecard (single value) visualizations. Favourable trends are indicated by a green arrow. 11. Click Save.

### 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.
2. Choose the calculated metric you want to edit from the Metric List page.
3. Click the 3-dot menu in the upper-right corner of the window and click Edit.
The Edit <name of metric> page opens.
4. To modify the formula, on the left side of the window, select .
5. Select a metric tile and, in the Data tab, edit its aggregation type and choose whether to use cumulative values. In the Filter tab, modify which members you want to include or exclude. (See below.) 6. You can also add or remove metrics from the formula as desired and rename the metric by selecting the name in the preview that displays on the right.
7. To modify display properties, on the left side of the window, select .
8. Rename the metric, change its format type, choose whether to use cumulative values, and whether you want a favourable trend to be indicated by trending up or down.
9. If you chose Currency as the format type in the previous step, optionally select a Currency display format from the drop-down list. Note: This is a display option only. Currency is not converted.
10. Click Save.
Note that the Save option is only available after you navigate to the Display settings step in the edit wizard.