Budget Layers
Konsolidat keeps every stakeholder's budget contribution as its own layer and sums the layers when it reads. The first submission, the finance cut, the management top-up and the board adjustment all survive as separate rows. Nothing overwrites anything.
Final budget = base + challenge + management + board, for every period.
The four layers
| Layer | Role that may edit it | Typical use |
|---|---|---|
base | Budget Submitter (alias: Entity Accountant) | The entity's own plan |
challenge | Budget Controller | Finance adjustments, usually cuts |
management | Budget Manager | Executive additions |
board | Budget Approver | Board-level adjustments |
System Manager may edit every layer. Everyone with read access to the entity can read every layer.
Source: LAYER_ROLES and LAYER_ROLE_ALIASES in konsol/epm/doctype/budget_sheet/budget_sheet.py; VALID_LAYERS in konsol/epm/budget_grain.py.
Where a layer lives in konsol
| Doctype | One record per | Holds |
|---|---|---|
| Budget Cycle | scenario × fiscal year | The lock. status is Open or Locked, with locked_by and locked_on. |
| Budget Sheet | cycle × entity × layer | annual_total and the lines. |
| Budget Line (child table) | account × budget dimensions | Twelve period columns period_01 … period_12 and annual. |
The budget dimensions are the Published Dimensions ticked in_budget. konsol adds one dim_* field per such dimension to Budget Line and Budget Annual Input; no dimension is named in shipped code (konsol#287).
A Budget Cycle cannot target a scenario of type actual. Actuals come from the GL.
How a cell gets in
| Path | What happens |
|---|---|
Excel =K.EPMSAVE(amount, entity, year, period, account, scenarioId, layer, [dimensions], [hierarchy], [node]) | Calls budget_cell_save. Writes one period on one line of the (cycle, entity, layer) sheet. A refused write shows #N/A with the reason. |
API budget_save / budget_save_batch | One line with a periods array. Each period carries its own layer (default base); a payload that mixes layers fans out across sheets. Only the periods you send are touched. |
| Frappe Desk | Edit the Budget Sheet directly. The sheet checks your role against its layer. |
Every path auto-creates the Budget Cycle for (scenario, fiscal year) as Open if it does not exist yet.
Locking
The Budget Cycle is the only approval gate. There is no per-document workflow.
- While the cycle is Open, anyone with the right role and entity access writes cells.
- The manager submits the cycle.
before_submitsetsstatus = Locked,locked_by,locked_on. - After the commit, every sheet of the cycle is exploded wide-to-tall into
epm_gold.budget_monthly_input(one row per non-zero period; zero months are not written). If D365 write-back is enabled for the entity, the sheet is also pushed to D365 budget register entries. - A write to a locked cycle is refused with HTTP 423 (
_assert_cycle_openinapi.py). The Budget Sheet itself and Budget Annual Input also refuse edits while the cycle is locked. - Cancel the cycle to amend. Status goes back to
Openand the sheet's rows are deleted fromepm_gold.budget_monthly_input.
ClickHouse only receives sheet rows on lock. Until the cycle is locked and the next dbt build has run, =K.EPM_BUDGET() does not show what is on the sheets.
Concurrent edits
budget_cell_save accepts an optional base_modified: the sheet's modified timestamp the client last read. If the sheet changed since then, the write is refused with HTTP 409 and a conflict payload (your_amount, current_amount, current_modified) so the client can refresh and ask again. Omit base_modified and the last write wins. Cells of one sheet serialise on a row lock; different (entity, layer) pairs are different sheets and do not contend.
Worked example
Scenario BUDGET_2025 (type budget, active), entity USMF, account 6100 (an Expense account), budget dimension dim_region = EU (a dimension this example site declared in_budget).
1. The entity submits (base)
| P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11 | P12 | Annual | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| base | 100,000 | 100,000 | 100,000 | 100,000 | 100,000 | 100,000 | 100,000 | 100,000 | 100,000 | 100,000 | 100,000 | 100,000 | 1,200,000 |
The cells land on the base Budget Sheet for USMF under the BUDGET_2025 × 2025 cycle, which is created Open on the first write.
2. Finance challenges (challenge)
A 5% cut in every month.
| P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11 | P12 | Annual | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| challenge | -5,000 | -5,000 | -5,000 | -5,000 | -5,000 | -5,000 | -5,000 | -5,000 | -5,000 | -5,000 | -5,000 | -5,000 | -60,000 |
| Subtotal | 95,000 | 95,000 | 95,000 | 95,000 | 95,000 | 95,000 | 95,000 | 95,000 | 95,000 | 95,000 | 95,000 | 95,000 | 1,140,000 |
3. Management adds (management)
Funding for a Q3 launch.
| P7 | P8 | P9 | Annual | |
|---|---|---|---|---|
| management | 15,000 | 15,000 | 10,000 | 40,000 |
4. The board adds Q4 contingency (board) and the manager locks the cycle
| P10 | P11 | P12 | Annual | |
|---|---|---|---|---|
| board | 5,000 | 5,000 | 5,000 | 15,000 |
| P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11 | P12 | Annual | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| FINAL | 95,000 | 95,000 | 95,000 | 95,000 | 95,000 | 95,000 | 110,000 | 110,000 | 105,000 | 100,000 | 100,000 | 100,000 | 1,195,000 |
What ClickHouse receives on lock
epm_gold.budget_monthly_input, one row per layer and non-zero month: 12 base + 12 challenge + 3 management + 3 board = 30 rows (not 48; zero months are skipped).
| scenario_id | data_area_id | fiscal_year | main_account | dim_region | fiscal_period | amount | layer |
|---|---|---|---|---|---|---|---|
| BUDGET_2025 | USMF | 2025 | 6100 | EU | 7 | 100,000 | base |
| BUDGET_2025 | USMF | 2025 | 6100 | EU | 7 | -5,000 | challenge |
| BUDGET_2025 | USMF | 2025 | 6100 | EU | 7 | 15,000 | management |
| BUDGET_2025 | USMF | 2025 | 6100 | EU | 10 | 5,000 | board |
| … |
What dbt produces
gold_spread_budget reads budget_monthly_input as an identity spread: each typed month is its own weight. Per layer it computes annual_amount = Σ amount and period_weight = amount / annual_amount, stamps spread_profile_id = 'manual', and keeps the layer column. For P7:
| layer | period_amount | annual_amount | period_weight | spread_profile_id |
|---|---|---|---|---|
| base | 100,000 | 1,200,000 | 100,000 / 1,200,000 = 0.0833 | manual |
| challenge | -5,000 | -60,000 | -5,000 / -60,000 = 0.0833 | manual |
| management | 15,000 | 40,000 | 15,000 / 40,000 = 0.375 | manual |
gold_scenario_trial_balance then sums the layers to one row per (scenario, entity, year, period, account, dimensions): P1–P6 = 95,000; P7–P8 = 110,000; P9 = 105,000; P10–P12 = 100,000. gold_variance_analysis and gold_budget_at_hierarchy_node read from there and from gold_spread_budget respectively.
If a Budget Annual Input row exists at the same grain, the manual base row replaces its spread; the other manual layers add on top. See Budget Spreading.
What Excel sees
=K.EPM_BUDGET() reads gold_spread_budget (Dataset budget_input, measure period_amount). With no layer argument it sums all layers; with one it filters to that layer.
| Formula | Result | Arithmetic |
|---|---|---|
=K.EPM_BUDGET("USMF", 2025, 5, "6100") | 95,000 | 100,000 − 5,000 |
=K.EPM_BUDGET("USMF", 2025, 7, "6100") | 110,000 | 100,000 − 5,000 + 15,000 |
=K.EPM_BUDGET("USMF", 2025, 10, "6100") | 100,000 | 100,000 − 5,000 + 5,000 |
=K.EPM_BUDGET("USMF", 2025, "Q1", "6100") | 285,000 | 3 × 95,000 |
=K.EPM_BUDGET("USMF", 2025, "Q3", "6100") | 325,000 | 110,000 + 110,000 + 105,000 |
=K.EPM_BUDGET("USMF", 2025, "H2", "6100") | 625,000 | 325,000 + 300,000 |
=K.EPM_BUDGET("USMF", 2025, "FY", "6100") | 1,195,000 | 1,200,000 − 60,000 + 40,000 + 15,000 |
=K.EPM_BUDGET("USMF", 2025, 5, "6100", , , , , "challenge") | -5,000 | the challenge layer only |
=K.EPM_BUDGET("USMF", 2025, "FY", "6100", , , , , "management") | 40,000 | the management layer only |
=K.EPM(entity, year, period, account, "period_amount", "budget", …, layer) is the long form of the same call.
Variance on the final budget
Actuals for P5 come in at 92,000.
| Formula | Result | How |
|---|---|---|
=K.EPM("USMF", 2025, 5, "6100", "actual_amount", "variance") | 92,000 | GL |
=K.EPM("USMF", 2025, 5, "6100", "budget_amount", "variance") | 95,000 | sum of layers |
=K.EPM_VARIANCE("USMF", 2025, 5, "6100") | -3,000 | 92,000 − 95,000 |
=K.EPM("USMF", 2025, 5, "6100", "variance_pct", "variance") | -3.16 | −3,000 / abs(95,000) × 100 |
=K.EPM("USMF", 2025, 5, "6100", "variance_favorable", "variance") | 1 | Expense, is_pnl = 1, actual < budget |
Variance rows exist only for scenarios the site declares as type budget and active. See the Variance Analysis Guide.
End-to-end flow
EXCEL / DESK / API KONSOL CLICKHOUSE EXCEL
────────────────── ────── ────────── ─────
=K.EPMSAVE(...) ──► budget_cell_save ──► Budget Cycle (Open)
└─ Budget Sheet (entity × layer)
└─ Budget Line (account × dims, P01..P12)
manager submits cycle ──► Locked (423 on further writes)
│ after commit, per sheet
├──► epm_gold.budget_monthly_input (one row per layer × non-zero month)
└──► D365 budget register (if enabled)
dbt build
├─ gold_spread_budget (keeps layer) ◄── =K.EPM_BUDGET(..., layer)
├─ gold_budget_at_hierarchy_node (keeps layer)
├─ gold_scenario_trial_balance (sums layers)
└─ gold_variance_analysis ◄── =K.EPM_VARIANCE(...)
Forecasts use the same path
A Budget Cycle may target any Scenario whose type is not actual (budget, forecast, strategic, operational). Layers, sheets, lock and Excel retrieval are identical. Pass the scenario in scenarioId:
=K.EPM_BUDGET("USMF", 2025, 5, "6100", , "FORECAST_Q3")
Only scenarios of type budget reach the variance models. Forecast rows sit in gold_scenario_trial_balance but never in the variance models (assert_scenario_rows_declared documents this as by design).
Key points
| Point | Detail |
|---|---|
| Layers are additive | The sum across layers is the final budget. There is no separate "final" row. |
| One lock | The Budget Cycle (scenario × year) is the only gate. Locked → 423. Cancel to reopen. |
| Sync on lock only | Sheets reach epm_gold.budget_monthly_input when the cycle locks, and leave it when the cycle is cancelled. |
| Zero means not budgeted | Zero months are not written to ClickHouse. |
| Layer survives into gold | gold_spread_budget and gold_budget_at_hierarchy_node carry layer; gold_scenario_trial_balance sums it away. |
| Role per layer | Each layer is locked to its role; System Manager edits all. |
| Dimensions are declared | Budget lines carry the in_budget Published Dimensions, whatever the site calls them. |
Next steps
- Budgeting Guide — top-down annual input and spread profiles
- Variance Analysis Guide — actual vs budget
- Excel Custom Functions —
K.EPM_BUDGET,K.EPMSAVE - Budget Spreading design — the
gold_spread_budgetSQL