Skip to main content

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:

PathWhoDoctypeLands in
Top-downA planner types one annual figure and picks a spread profileBudget Annual Input + Spread Profileepm_gold.budget_annual_input, spread by dbt into 12 months
Bottom-upEntities type months, in layers, from Excel or DeskBudget Cycle → Budget Sheet → Budget Lineepm_gold.budget_monthly_input, on cycle lock
ERPD365 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:

FieldTypeNotes
scenario_idLink → ScenarioRequired
data_area_idLink → EntityRequired
fiscal_yearIntRequired
main_accountDataRequired
annual_amountCurrencyRequired
spread_profile_idDataRequired. Must match a Spread Profile profile_id, or the row produces no months (inner join).
submitted_byLink → UserStamped with the current user if blank
dim_*DataOne 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_budget would 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_input after 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:

Period123456789101112
Weight0.60.50.70.80.91.00.80.91.01.31.82.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' and spread_profile_id = the profile.
  • Sheet rows keep their own layer, get spread_profile_id = 'manual', and are an identity spread (period_weight = amount / Σ amount within the layer).
  • Where a sheet has a base row 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_idscenario_type
ACTUALactual
BUDGETbudget
FORECASTforecast

The warehouse reads the type, never the code (konsolidat#206):

  • gold_scenario_trial_balance stamps GL rows with the single active actual scenario (falls back to ACTUAL if none or several are declared), takes D365 budget register entries as BUDGET, and sums gold_spread_budget layers under their own scenario_id.
  • The variance models (gold_variance_analysis and its variants) compare actuals against every active budget-type scenario, one row set each. Forecasts never reach variance.
  • gold_scenario_versions lists every scenario with its source (konsol, or api for ones created only through the API).
  • assert_scenario_rows_declared fails 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.

ArgumentEffect
period1–12, Q1–Q4, H1–H2, FY. Ranges sum period_amount; FY equals annual_amount.
dimensionsFilter 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.
scenarioIdPick the scenario, e.g. "BUDGET_2025" or "FORECAST_Q3".
layerbase, 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​

  1. Create the Scenario (type budget or forecast, Active) if it does not exist.
  2. Create the Spread Profile: twelve records with the same profile_id.
  3. Create one Budget Annual Input per entity and account, pointing at the profile.
  4. Run or wait for the next dbt build. gold_spread_budget now has twelve rows per input, layer = 'base'.
  5. 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​

TestWhat it checks
assert_spread_sums_to_annualΣ period_amount = annual_amount within 0.01, per budget line
assert_spread_has_12_periodsEvery annual-spread line has exactly 12 periods (manual sheets are excluded: a sheet may budget part of a year)
assert_budget_fact_grain_uniqueNo duplicated grain after the manual-over-annual precedence
assert_scenario_rows_declaredEvery scenario with rows is declared, active and of the right type

Next steps​