atoti.shift(measure, on, /, *, offset=1, partitioning=None, mode=‘measure’)
Return a measure equal to the passed measure shifted to another member of the hierarchy.- Parameters:
- measure (VariableMeasureConvertible) – The measure to shift.
- on (Hierarchy) – The hierarchy to shift on.
-
offset (int) –
The number of members to shift by.
-
partitioning (Level | None) –
The level in the hierarchy at which to start over again.
-
mode (Literal [ ‘measure’ , ‘hierarchy’ ]) –
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
Nonewhere its input is alsoNone. -
(Wed, C) is
100because shifting by offset-1along Day lands on (Tue, C) at which Value.SUM has no value so the shifting continues to the first non-Nonevalue: the one at (Mon, C). → offset is lax.
-
(Tue, C) and (Wed, B) have no values because Value.SUM also has no values at these locations.
→ The returned measure always evaluates to
- mode=hierarchy:
-
(Tue, C) is
100even though Value.SUM has no value at this exact location because shifting by offset-1along 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
-1along Day lands on (Tue, C) at which Value.SUM has no value. → offset is strict.
-
(Tue, C) is
- mode=measure:
- Return type: MeasureDefinition
See also:
date_shift().