Calculated Metrics: Formulas & Filtered metrics

Calculated Metrics must be used to provide analytics that cannot be solved by a simple aggregation. Use cases are numerous and related to your own log data but we can cite things as Click Through Rates, Bounce Rates, Weighted Computations, etc...

Creating a calculated metric

If you want to create Calculated Metrics please click on the configure button on the side menu, and then on Fields & Metrics and then on the Calculated Metrics tab:

The list of available metrics

The list of available metrics

A calculated metric can be either a Filtered metric or a Formula metric

Formula metric

Formula metrics allow you to combine different metrics / filtered metrics / other formula metrics with a formula. The available operators are:

  • +: addition
  • -: subtraction
  • /: division
  • *: multiplication
  • ^: power of

You can use parentheses `( ... )` to ensure the operators are applied as expected.

To create one just click on Formula Metric:

The Formula Metric editor

The Formula Metric editor

Let's say you want to create a metric that gives you the average number of links browsed by each individual user.

Get the id of the metrics you want to assemble

First you need to get the ids of user.uniq and url.uniq metrics shown in the first screenshot.

To find them, go on one of the metric and click on it, then on "more":

cust_useruniq is the id of the "user.uniq" metric

cust_useruniq is the id of the "user.uniq" metric

In the example above cust_useruniq is the id of user.uniq. And let's assume custom_urluniq is the one for url.uniq.

In our case, we are just going to divide custom_urluniq by cust_useruniq as shown below:

A simple ratios between Nb of URLs by Nb of users

A simple ratios between Nb of URLs by Nb of users

Validation of the name of the formula is mandatory!

As you can see when you open the editor above, the formula and the name text boxes are red. You won't be able to save your metric until they are both correct.

Filtered metric

Filtered metrics are actually providing filtered aggregation of any regular metric. This is then the combination of a metric (an attribute and an aggregation function) and a context filter (a set of filters, search etc...).

Click on Filtered Metric:

The Filtered Metric editor

The Filtered Metric editor

Filtered metrics helps in pretty standard use cases and can be combined in chained Formula Metric. Here are some examples:

  • Computing ratios of login failures over all the login tentatives
  • Computing click-through-rates
  • Computing bounce rates
  • etc...

Select an attribute and an aggregation function as you would do for any other metric. Then click on filter and select a filter context that will be applied over all the computations.

Creating a filtering metric

Creating a filtering metric

Using the new calculated metric

A Formula metric or a Filtered metric can be used as any regular ones. In The exploration view, just pull it like any other.