Custom KPI Formulas

Build a KPI from a math expression over your datasource's numeric fields — for ratios, rates, and margins that a single aggregation can't express.

When to use a formula

Standard KPIs apply one aggregation (Sum, Average, Min, Max, Count) to a single numeric field. Choose Custom Formula as the aggregation when you need to combine two or more fields — for example a conversion rate(conversions ÷ sessions), a profit margin, or revenue per user. This is also the supported way to build a ratio or percentage KPI.

Syntax

  • Reference a field by wrapping its column name in braces: {field_name}.
  • Use the operators + - * / and parentheses ( ) for grouping.
  • Multiply a ratio by 100 to express it as a percentage.
1{conversions} / {sessions} * 100

Which fields can I reference?

The variables available to a formula are exactly the numeric fields of the datasource you selected — the same list shown in the Metric Fielddropdown for a standard KPI. Each field is first aggregated over your chosen time window (e.g. summed across the days of the month), and the formula then runs on those window totals.

One datasource at a time

A formula can only reference fields from the single datasourceselected on the KPI. You can't mix fields from two different sources (for example sessions and ad spend) in one formula.

Good to know

  • Don't write function calls like AVG(...) or SUM(...) — aggregation over the window happens automatically. Formulas are plain arithmetic.
  • Division by zero (e.g. a denominator field with no data in the period) yields no value for that period, shown as “No data” rather than 0.
  • Only numbers, the four math operators, and parentheses are allowed — anything else is rejected for safety.
  • Reference a field by its raw column name (e.g. total_bounces), not its friendly label.

Create one

Open Product Analytics → KPI Tracking → New KPI, pick your datasource, set Aggregation to Custom Formula, and enter your expression. The available field names for the formula are listed beneath the editor.