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.
