Create a custom measure

Create a custom measure with a user-defined formula. Custom measures let you define calculated fields using existing Analytics API schema fields as variables.

Use ${fieldName} syntax in the formula to reference schema fields. The unitType controls how the result is displayed: CURRENCY, PERCENTAGE, BYTES, BINARY_BYTES, CORES, KILOGRAMS, or STANDARD.

Formulas support numeric literals, ${fieldName} references, parentheses, unary minus, and +, -, *, /. PER_HOUR(expression) divides by the hours covered by each result period; it cannot be nested. A sum of hourly rates is not the overall hourly rate: evaluate at the intended reporting period. Changing unitType changes display, not the arithmetic or currency conversion. Saving validates formula and filter structure but does not guarantee that every referenced measure is available in Analytics metadata or that a later query will succeed.

Use ${schemaFieldName?filters_binding=bindingName} for per-variable filters. Binding names start with a letter or underscore and contain only letters, numbers, and underscores. Every map key must be referenced by the formula and every reference must have a nonempty filter list; top-level filters are AND-combined. At most 32 bindings and nesting depth 4 are accepted. Unreferenced keys, unresolved references, excess bindings, or excessive depth return INVALID_VARIABLE_FILTERS. Invalid binding names in the formula return INVALID_FORMULA; empty filter lists return ERROR_INVALID_PARAMS. Display names cannot resemble reserved FOCUS columns; names and descriptions cannot contain HTML.

PER_HOUR is case-insensitive and takes one nonempty argument. Invalid syntax or unknown functions return INVALID_FORMULA. Division preserves undefined ratios rather than replacing them with zero. PER_HOUR uses the full output-period duration, so a period with partial data can read low. Rollup with time precision is unsupported; without time precision, a positive bounded query time window is required.

Body Params
uuid
required
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$

Ternary tenant UUID

string
required
length ≥ 1

Name of the Analytics API data source in which this custom measure resides

string
required
length ≥ 1

Display name for the measure

string
required
length ≥ 1

Formula expression; use ${} to insert variables by Analytics API schema field names.

string

Description of the measure

string
enum
required

The unit a measure is reported in, for example CURRENCY or STANDARD.

Allowed:
variableFilters
object

Named filters referenced by formula variables using filters_binding. At most 32 bindings; filter nesting depth is at most 4. Omit this field or use {} when the formula has no binding references. Null is not accepted. The resulting formula must resolve all binding references.

Responses

Language
Credentials
Bearer
JWT
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json