# Calculated metrics

Sometimes metrics don’t provide the type of information you’re looking for. Creating calculated metrics can help you get the accurate, relevant data you need.

For example, in Google Analytics, the metrics “Page Views” and “Sessions” provide valuable data but don’t tell you the number of pages views for each session. Using calculated metrics, you can get this information by combining these two metrics using a formula `(Number of Page Views / Number of Sessions)` to create a “Page Views per Session” metric.

## What are calculated metrics?

Calculated metrics combine metrics 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:

• When creating a calculated metric, dimensions are selected for you, based on shared, common dimensions from your referenced metrics.
• 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 options: This is where you give your calculated metric a name and set options. 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 Options 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.

1. Click Calculate a new metric.
2. 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.

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.

1. 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.

1. If you want to apply filters, click on the referenced metric and, under Filters, select the members to filter for each dimension. Next, select either Include or Exclude, and click Filter.

1. When you’re done building your formula, click Next.
2. In the Options window, under Metric name, type a name for your calculated metric.

You can also name your metric in the Preview pane.

1. Under Format, choose a format type from the drop-down menu.
2. Optionally, set your data to Show as cumulative.
3. 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.

1. Click Save.

## Editing a calculated metric

After creating a calculated metric, you can edit it to modify its formula, name, format type, and other optional 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.

The metric opens in its Explore View.

1. Click the 3-dot menu beside the metric’s name and click Edit.

The Edit <name of metric> page opens.