Skip to content

Rolling Values Using Formula

Rolling balances and depreciation calculations can be implemented using the SEQUENCE workview function.

SEQUENCEThe sequence function returns data from a specified relative location in the same cube but changes one element from one dimension based on a relative position number and a hierarchy.

SEQUENCE("DimName", ”HierarchyName”, PositionalChange, ["Relative Cell"])

SEQUENCE("Time", "Month List", -1, ["Closing Balance"])

This example will return the closing balance of the previous month.
ISLEVELZEROThe isLevelZero function returns 1 if the element from the specified dimension has no child elements.


IF( ISLEVELZERO("Time") = 1 , CONTINUE , 0 )
ELEMENTThe element function returns the name of the element (excluding the hierarchy prefix) for the cell being evaluated.


POSITIONThe position function returns the index of an element within a specific dimension and hierarchy.

POSITION("DimName", "HierarchyName", "ElementName")

POSITION("Time", "Month List", "2017 - Jan")

This example will return 1 if the element “2017 – Jan” is the first element in the “Month List” hierarchy.


When using the sequence function, it is possible to create a circular reference. MODLR has some detection for circular references however if the circular loop spans enough distinct cube cells it will likely terminate the MODLR Instance. A log will be generated in this instance.

Formula Values

In the above example, the Time and Measures dimensions are being hidden from the workview. For the time dimension the initial six columns are against a No Time element and the subsequent columns reflect 12 months of the current year. For the Measures dimension the first six columns use elements which are reflected in the custom header, the subsequent columns use an element called Depreciation.