Skip to main content
atoti.shift(
    measure: VariableMeasureConvertible,
    on: Hierarchy,
    /,
    *,
    offset: int = 1,
    partitioning: Level | None = None,
    mode: Literal[‘measure’, ‘hierarchy’] = 'measure',
) → MeasureDefinition
Return a measure equal to the passed measure shifted to another member of the hierarchy.

Parameters

measure

The measure to shift.

on

The hierarchy to shift on.

offset

The number of members to shift by.

partitioning

The level in the hierarchy at which to start over again.

mode

Whether the shift is driven by the values of the input measure in the query result or by the members of the on hierarchy.
  • mode=measure:
    • (Tue, C) and (Wed, B) have no values because Value.SUM also has no values at these locations. → The returned measure always evaluates to None where its input is also None.
    • (Wed, C) is 100 because shifting by offset -1 along Day lands on (Tue, C) at which Value.SUM has no value so the shifting continues to the first non-None value: the one at (Mon, C). offset is lax.
  • mode=hierarchy:
    • (Tue, C) is 100 even though Value.SUM has no value at this exact location because shifting by offset -1 along Day lands on (Mon, C) which does have a value. → The returned measure evaluates to the input measure’s value at the shifted location, even where the input measure at the current location has no value.
    • (Wed, C) has no value because shifting by offset -1 along Day lands on (Tue, C) at which Value.SUM has no value. offset is strict.

See also: date_shift().