Menu โ–พ โ–ด

#174 Define the budget sign convention for konsol-authored budgets (the D365 adapters go with the ERP tree)

open
nobody
None
2026-09-17
2026-09-13
Anonymous
No

Originally created by: grynn-in

Found reviewing [#158] (PR [#168]).

Actuals are signed (period_net_amount = debit โˆ’ credit, enforced by a test). Budgets have no defined sign convention:

  • The live raw D365 budgets are all positive (672 of 672), revenue accounts included. They stay positive through silver_budget_entries and gold_scenario_trial_balance (gold_scenario_trial_balance.sql passes the amount through as-is).
  • stg_erpnext__budget_entries also passes budget_amount through unsigned.
  • No layer flips the sign, and no test checks it. gold_variance_analysis therefore compares signed revenue actuals with positive revenue budgets, which skews the favorable/unfavorable logic.

Decide: does a budget arrive signed like actuals (credit accounts negative), or as a magnitude that one layer signs by account type?

Then:

  • Apply the rule in every adapter, or in exactly one silver model.
  • Fix the variance logic in gold_variance_analysis.
  • Add a test.
  • Update models/staging/README.md, which since [#168] says the budget sign convention is not yet defined.

Related

Tickets: #158
Tickets: #168
Tickets: #176
Tickets: #177
Tickets: #210

Discussion

  • Anonymous

    Anonymous - 2026-09-15

    Originally posted by: grynn-in

    Verdict: LIVE, confirmed by the repo's own documentation. dbt_project/models/staging/README.md:81 still states: "Budget amount: no sign convention is defined or enforced yet."

    Worth sequencing with the two other open budget-path issues, since all three touch the same models: konsolidat#206 (variance filters scenario_id = 'BUDGET', so konsol-authored budgets never reach it) and konsolidat#187 (the FULL OUTER JOIN below). A sign convention decided after those are fixed risks a third pass over the same files.

    ๐Ÿค– Triage against main โ€” Claude Code ยท https://claude.ai/code/session_01P3Pf9835FeLeXjRrYTTZ1M

     
  • Anonymous

    Anonymous - 2026-09-17

    Originally posted by: grynn-in

    Re-scoped โ€” the ERP half of this issue dies with the staging tree

    The ERP staging tree is being removed (konsolidat#221, Deepak Pai, 17 September 2026).

    Out of scope now: the D365 budget adapters. silver_budget_entries is fed entirely by bronze_budget_transaction_lines and bronze_budget_register_entries, both from stg_d365_fo__budget_*. It goes when the tree goes. The "live raw D365 budgets are all positive (672 of 672)" observation in the body no longer needs a convention โ€” that data will not exist.

    Still in scope, and the whole of it: konsol-authored budgets. Budget Cycle to Budget Sheet to gold_spread_budget to gold_scenario_trial_balance is the surviving path, and dbt_project/models/staging/README.md:81 still says outright that "no sign convention is defined or enforced yet".

    So the question is unchanged in substance and smaller in surface: what is the sign of a konsol-authored budget amount, and where is it enforced? Actuals are signed (period_net_amount = debit โˆ’ credit, pinned by a test); budgets have no equivalent.

    Sequence it after konsolidat#206 and konsol#214, which are already rewriting the variance path โ€” a convention decided before those land would be re-litigated by them.

    ๐Ÿค– Claude Code ยท https://claude.ai/code/session_01P3Pf9835FeLeXjRrYTTZ1M

     

Log in to post a comment.