BASELINE

BASELINE(baseline, reference, fallback=None)[source]

Returns the value of a tracked field or named value at a captured baseline.

Until the baseline is captured at runtime, the function evaluates to blank (or to fallback if supplied). Use HASBASELINE() to guard against the not-yet-captured case. BASELINE does not create a dependency cycle with the live value, so a field may reference its own baseline.

Parameters:
  • baseline (Baseline | str) – The baseline to read from, or its name.

  • reference (Field | Calculation | Parameter) – The tracked field or named value to read. Must be a single field or named-value reference — expressions are not supported (write BASELINE(b, [a]) + BASELINE(b, [c]) instead of BASELINE(b, [a] + [c])).

  • fallback (Field | Calculation | Parameter | None) – Optional. A field or named value supplying the value to use before the baseline has been captured. Must share reference’s data type.

Return type:

Formula

Returns:

The baselined value of reference, with the same data type.

Raises:
  • TypeError – If reference (or fallback) is not a field or named value — a baseline can only read a single tracked element, not an expression.

  • ValueError – If reference is not assigned to any tracking group, or if fallback has a different data type to reference.

Examples

Delta since optimisation:

revenue - BASELINE("optimised", revenue)

With a fallback to the live value:

BASELINE("optimised", revenue, revenue)

``baseline`` — accepted types

  • STRING

``reference`` — accepted types

  • BOOLEAN

  • BOOLEAN_ARRAY

  • BOOLEAN_MAP

  • DATE

  • DATETIME

  • DATETIME_ARRAY

  • DATETIME_MAP

  • DATE_ARRAY

  • DATE_MAP

  • DECIMAL

  • DECIMAL_ARRAY

  • DECIMAL_MAP

  • INTEGER

  • INTEGER_ARRAY

  • INTEGER_MAP

  • NULL

  • OBJECT

  • OBJECT_ARRAY

  • STRING

  • STRING_ARRAY

  • STRING_MAP

  • TIME

  • TIME_ARRAY

  • TIME_MAP

``fallback`` (optional) — accepted types

  • BOOLEAN

  • BOOLEAN_ARRAY

  • BOOLEAN_MAP

  • DATE

  • DATETIME

  • DATETIME_ARRAY

  • DATETIME_MAP

  • DATE_ARRAY

  • DATE_MAP

  • DECIMAL

  • DECIMAL_ARRAY

  • DECIMAL_MAP

  • INTEGER

  • INTEGER_ARRAY

  • INTEGER_MAP

  • NULL

  • OBJECT

  • OBJECT_ARRAY

  • STRING

  • STRING_ARRAY

  • STRING_MAP

  • TIME

  • TIME_ARRAY

  • TIME_MAP

Return types

  • BOOLEAN

  • BOOLEAN_ARRAY

  • BOOLEAN_MAP

  • DATE

  • DATETIME

  • DATETIME_ARRAY

  • DATETIME_MAP

  • DATE_ARRAY

  • DATE_MAP

  • DECIMAL

  • DECIMAL_ARRAY

  • DECIMAL_MAP

  • INTEGER

  • INTEGER_ARRAY

  • INTEGER_MAP

  • OBJECT

  • OBJECT_ARRAY

  • STRING

  • STRING_ARRAY

  • STRING_MAP

  • TIME

  • TIME_ARRAY

  • TIME_MAP