Two Minute Reports Logo
Custom fields

Formulas and conditions

Build custom metrics with math operators and custom dimensions by combining fields and text, then add conditional rules to return values only when conditions match.

The Formula method is the most flexible way to build a custom field. For metrics it's a math expression; for dimensions it combines fields and text into a label. On top of either, you can add conditional rules so the field only returns a value when your conditions match.

Formulas for metrics

A custom metric formula is an arithmetic expression built from fields, numbers, and operators. You assemble it in the formula editor by adding field chips, typing numbers, and inserting operators.

Build a formula

  • Select Browse fields (or start typing a field name) to insert a field
  • Type a number and press Enter to add a numeric constant
  • Select Browse operators to insert a math operator

The editor checks the formula as you go, with messages like "Formula looks good", "Formula ends with an operator", or "Missing operator between fields".

Operators

OperatorMeaning
+Add
-Subtract
*Multiply
/Divide
%Modulo (remainder)
^Power
( )Parentheses for grouping
Fields are aggregated automatically based on the fields used. You don't write SUM or AVG. Write the formula as if on totals, for example spend / conversions.

Common metric recipes

MetricFormula
CPA (cost per acquisition)spend / conversions
ROAS (return on ad spend)revenue / spend
CPC (cost per click)spend / clicks
Conversion rateconversions / clicks * 100
AOV (average order value)revenue / orders
Select Browse examples to see ready-made recipes like these. Pick one to put it in the editor, then change it to fit your data.

Formulas for dimensions

For dimensions, the Formula method combines fields and text into a single value instead of doing math. This is how you build labels and cleaned-up names.

  • Add field chips the same way as for metrics
  • Type text and press Enter to add a text constant
  • Select Add space to insert a space between parts

For example, combine a source field, a space, and a medium field to produce a "Source / Medium" label. Math operators aren't available for dimensions, because dimensions are about text, not calculations.

Conditional rules

Turn on Set condition in the builder to make a field return its value only when your conditions match. This is CASE-style logic: "when the campaign name contains 'brand', label it Branded".

How conditions work

Each condition reads When field is operator values:

OperatorMatches when the field…
Equalsexactly matches a value
Not equalsdoes not match
Containsincludes the text
Not containsdoes not include the text
  • Add multiple conditions and join them with AND or OR
  • Values autocomplete from the real distinct values in your data

Multiple rules (dimensions)

Custom dimensions support multiple rules for IF/ELSE-style mapping. Select + Add rule to add another rule. Rules are evaluated top to bottom and the first matching rule wins. A final rule with no condition acts as the "else" catch-all. If nothing matches, the field uses its fallback value.

Order matters: put your most specific rules first and a general catch-all last, so a value doesn't get caught by a broad rule before reaching a precise one.

Next steps

Copyright © 2026