Budgeting Guide
Konsolidat holds budgets in konsol doctypes and turns them into one monthly budget fact, gold_spread_budget, in ClickHouse. Excel reads that fact with =K.EPM_BUDGET().
There are three ways a budget figure gets in:
| Path | Who | Doctype | Lands in |
|---|---|---|---|
| Top-down | A planner types one annual figure and picks a spread profile | Budget Annual Input + Spread Profile | epm_gold.budget_annual_input, spread by dbt into 12 months |
| Bottom-up | Entities type months, in layers, from Excel or Desk | Budget Cycle → Budget Sheet → Budget Line | epm_gold.budget_monthly_input, on cycle lock |
| ERP | D365 F&O budget register entries, synced by the connector | — | silver_budget_entries, read by gold_scenario_trial_balance as scenario BUDGET |
The bottom-up path is covered in the Budget Layers Guide. This page covers the top-down path, spread profiles, scenarios and Excel retrieval.
Since konsolidat#146/#147 the dbt project ships no seed CSVs. Every budget table is written by konsol.
Data flow
graph LR
BAI[Budget Annual Input<br/>one annual figure] --> CH1[epm_gold.budget_annual_input]
SP[Spread Profile<br/>12 weights per profile] --> CH2[epm_gold.spread_profiles]
BS[Budget Sheet on cycle lock<br/>months x layers] --> CH3[epm_gold.budget_monthly_input]
CH1 --> SPREAD[gold_spread_budget<br/>one row per period x layer]
CH2 --> SPREAD
CH3 --> SPREAD
SPREAD --> STB[gold_scenario_trial_balance<br/>layers summed]
STB --> VAR[gold_variance_analysis]
SPREAD --> XL[K.EPM_BUDGET<br/>Dataset budget_input]
SPREAD --> NODE[gold_budget_at_hierarchy_node]
Top-down: Budget Annual Input
One record per (scenario, entity, fiscal year, account, budget dimensions). Fields:
| Field | Type | Notes |
|---|---|---|
scenario_id | Link → Scenario | Required |
data_area_id | Link → Entity | Required |
fiscal_year | Int | Required |
main_account | Data | Required |
annual_amount | Currency | Required |
spread_profile_id | Data | Required. Must match a Spread Profile profile_id, or the row produces no months (inner join). |
submitted_by | Link → User | Stamped with the current user if blank |
dim_* | Data | One field per Published Dimension ticked in_budget; added by konsol, not shipped (konsol#287) |
Rules enforced by the doctype (budget_annual_input.py):
- One row per grain. A second row at the same (scenario, entity, year, account, dimensions) is refused, because
gold_spread_budgetwould spread both and double the budget. - Locked cycle, no edits. If a Budget Cycle for the same (scenario, fiscal year) is
Locked, insert, edit, cancel and delete are all refused. The lock covers both input paths. - Every save and delete republishes the table to
epm_gold.budget_annual_inputafter commit.
Spread Profiles
A Spread Profile is twelve records with the same profile_id, one per fiscal_period, each with a weight. Weights are relative: dbt normalises them.
period_weight = weight / SUM(weight over the 12 records of the profile)
period_amount = annual_amount × period_weight
No profile ships with konsol. Create your own in Desk (Spread Profile) or through the API. Two common patterns:
EVEN — weight 1.0 in every period. 1,200,000 → 100,000 a month.
SEASONAL_RETAIL — a Q4 peak:
| Period | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Weight | 0.6 | 0.5 | 0.7 | 0.8 | 0.9 | 1.0 | 0.8 | 0.9 | 1.0 | 1.3 | 1.8 | 2.5 |
Sum of weights = 12.8. For 600,000:
- Period 2 (lowest): 600,000 × 0.5 / 12.8 = 23,437.50
- Period 12 (highest): 600,000 × 2.5 / 12.8 = 117,187.50
Weights do not need to sum to 12 or to 1. assert_spread_sums_to_annual checks that the twelve months add back to annual_amount within 0.01.
Each Spread Profile save republishes epm_gold.spread_profiles.
How the two input paths combine
gold_spread_budget unions both paths and resolves overlap:
- Annual-spread rows are stamped
layer = 'base'andspread_profile_id= the profile. - Sheet rows keep their own
layer, getspread_profile_id = 'manual', and are an identity spread (period_weight = amount / Σ amountwithin the layer). - Where a sheet has a
baserow at the same (scenario, entity, year, account, dimensions), the annual-spread rows for that grain are dropped. Typed months win. Non-base sheet layers are purely additive.
assert_budget_fact_grain_unique checks no grain is double counted.
Scenarios
A Scenario record has scenario_id, scenario_name, scenario_type (actual, budget, forecast, strategic, operational) and is_active. konsol ships three defaults:
| scenario_id | scenario_type |
|---|---|
ACTUAL | actual |
BUDGET | budget |
FORECAST | forecast |
The warehouse reads the type, never the code (konsolidat#206):
gold_scenario_trial_balancestamps GL rows with the single activeactualscenario (falls back toACTUALif none or several are declared), takes D365 budget register entries asBUDGET, and sumsgold_spread_budgetlayers under their ownscenario_id.- The variance models (
gold_variance_analysisand its variants) compare actuals against every activebudget-type scenario, one row set each. Forecasts never reach variance. gold_scenario_versionslists every scenario with its source (konsol, orapifor ones created only through the API).assert_scenario_rows_declaredfails the build when a scenario with rows is undeclared, inactive, or of the wrong type for its source.
A Budget Cycle refuses a scenario of type actual.
Reading budgets in Excel
=K.EPM_BUDGET("USMF", 2025, 5, "6100")
is the same as
=K.EPM("USMF", 2025, 5, "6100", "period_amount", "budget")
Both read gold_spread_budget through the Dataset budget_input.
| Argument | Effect |
|---|---|
period | 1–12, Q1–Q4, H1–H2, FY. Ranges sum period_amount; FY equals annual_amount. |
dimensions | Filter on the site's budget dimensions: one text cell such as "dim_region=EU;dim_product=X", or a 2-column range of name/value rows (konsol#287). See Dimensions. |
scenarioId | Pick the scenario, e.g. "BUDGET_2025" or "FORECAST_Q3". |
layer | base, challenge, management or board. Omit to get the final budget (all layers summed). |
Measures: period_amount (default) and annual_amount.
Adding a new budget, top-down
- Create the Scenario (type
budgetorforecast, Active) if it does not exist. - Create the Spread Profile: twelve records with the same
profile_id. - Create one Budget Annual Input per entity and account, pointing at the profile.
- Run or wait for the next dbt build.
gold_spread_budgetnow has twelve rows per input,layer = 'base'. - Read with
=K.EPM_BUDGET(entity, year, period, account, , "<scenario_id>").
To lock the figures, create and submit a Budget Cycle for the scenario and year. Annual input is refused while it is locked.
dbt tests on the budget fact
| Test | What it checks |
|---|---|
assert_spread_sums_to_annual | Σ period_amount = annual_amount within 0.01, per budget line |
assert_spread_has_12_periods | Every annual-spread line has exactly 12 periods (manual sheets are excluded: a sheet may budget part of a year) |
assert_budget_fact_grain_unique | No duplicated grain after the manual-over-annual precedence |
assert_scenario_rows_declared | Every scenario with rows is declared, active and of the right type |
Next steps
- Budget Layers Guide — bottom-up entry, layers, locking, worked example
- Variance Analysis Guide — actual vs budget
- Excel Custom Functions — all
K.*functions - Budget Spreading design — the SQL behind
gold_spread_budget