Funnel has two types of custom metrics: formula custom metrics, and rule custom metrics. They operate on different levels of aggregation; rule metrics are calculated per row pre-aggregation, formula metrics operate on totalled data, post-aggregation. Read more about how formula and rule metrics are calculated.

Rule metrics work like any other metric in Google Data Studio so the rest of this article concerns formula metrics.

Funnel formula metrics

A formula metric is a simple arithmetic formula like for instance:

CPC =  cost / clicks

Read more about creating custom metrics.

Google's calculated fields

Calculated fields are almost identical to Funnel's metrics. Remember how Funnel has two types of metrics? Data Studio has them too, but the difference can be hard to see. This formula, for instance, operates post-aggregation, and has aggregation 'Auto':

SUM(cost) / SUM(clicks)

Aggregation type 'Auto' means that Data Studio will not try to aggregate these values further after the formula is applied, and cannot be changed by the user.

This formula operates on each row of data, and can be aggregated after the formula is applied:

 cost * 2

The aggregation type defaults to 'Sum' but can be changed to, for example, 'Average' or 'Max':

The difference in the formula is the SUM().  This tells Data Studio to first add up all the cost  values, then all the clicks  values, then divide total cost with total clicks.

Without SUM()  Data Studio will apply the formula to every row of data.

Note that you can't combine SUM()  with non-totalled metrics, for instance

SUM(cost) / clicks

Will result in an error in the Data Studio formula editor.

How Funnel exports formulas to Data Studio

Funnel formula custom metrics are exported to Google Data Studio, and are available for use just like any other metric. The difference is that Funnel exports the formula, not the values; in the CPC example above, Data Studio will request cost  and clicks  from Funnel and apply the formula itself.

When Funnel exports formula custom metrics, we want post-aggregation, so Funnel's CPC formula:

 cost / clicks  

Is in Data Studio:

SUM(cost) / SUM(clicks)
Did this answer your question?