atoti.shift(Return a measure equal to the passed measure shifted to another member of the hierarchy.
measure: VariableMeasureConvertible,
on: Hierarchy,
/,
*,
offset: int =1,
partitioning: Level | None =None,
mode: Literal[‘measure’, ‘hierarchy’] ='measure',
) → MeasureDefinition
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
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
See also:
date_shift().