A value in a Layerz model is either typed (an assumption), computed (a formula, a balance, a total), or imported (actuals from a source). Each has one home, so a number can always be traced back.
Typed inputs
An assumption holds its values in one of two forms:
- a scalar
value, held every period (a price, a rate, a starting headcount); - a series
values, one per period of its grain. A series shorter than the horizon carries its last value to the end; a longer one is cut.
A list-mode line holds a series per element instead (timeline_values, keyed by element). A single cell can be changed without resending the series, by keying the period: { "2027-06": [-120] }.
Formulas
A formula is an expression over other lines, read by name:
Gross margin = Revenue - COGS
Payroll = Headcount * Average salary / 12
Interest = Debt_M-1 * Rate / 12
Revenue growth = Revenue / Revenue_Y-1 - 1
The language has arithmetic and comparison operators, conditions (IF, AND, OR), rounding, time aggregates (YTD, TTM), finance functions (IRR, NPV), period tokens (CURRENT_PERIOD, PERIOD_YEAR, IS_ACTUAL) and list functions. It has no error values and no cell references. The complete grammar is in Formula language.
How the model computes
- The engine reads every formula, builds the dependency graph and computes in order. Inputs a formula reads are derived from its expression: nobody declares them.
- A cycle (a line that reads itself in the same period) is rejected unless it goes through a lag. When a model cannot compute (a cycle, a reference to a deleted line), it says so (
computable: false) and names the cause. - A formula whose inputs are all constants, or that returns one figure (
IRR,NPV), is computed once.
Values in other branches
Typed values belong to the base plan unless written on a scenario, where only the cells that differ are stored. A formula can read another scenario's value with LAYER(Revenue, Budget). See Scenarios and actuals.