Skip to main content

Silver Models

10 models in the epm_silver schema. Silver joins and cleans bronze, and brings in the governed reference data konsol writes to epm_staging.

silver_gl_entries​

One GL-shaped row per posting, from two sources in one UNION ALL:

  1. ERP lines: bronze_general_journal_account_entries joined to bronze_general_journal_entries (journal header, on general_journal_entry_recid and data_area_id) and to silver_main_accounts (account name, type, P&L / balance-sheet flags). The fiscal year and period come from the entity's own calendar: epm_gold.entity_fiscal_calendars maps the entity to a calendar ('Fiscal' when it has no row) and silver_fiscal_periods is expanded to one row per calendar date; an entity whose calendar is not loaded falls back to the calendar year and month of accounting_date.
  2. Submitted trial balances: silver_tb_movements, one synthetic entry per (entity, period, account, partner, dimensions) movement, recid a negative hash so it never collides with an ERP id, posting_type and journal_category = Trial Balance Submission, journal_number = TBS-<batch_id>. accounting_date is the first day of the entity's own fiscal period. The year-end close rows silver_tb_movements synthesizes carry posting_layer = 'Year-end close' (konsolidat#259).

Debit and credit are derived from the sign of accounting_currency_amount (konsolidat#112): positive is debit, negative is credit. The ERP's own debit/credit flag (is_credit) is retired.

ColumnTypeDescription
recidInt64ERP record id; negative hash for submitted rows
data_area_idStringLegal entity
accounting_dateDatePosting date
fiscal_year, fiscal_periodUInt16, UInt8From the entity's fiscal calendar
main_accountStringAccount code
account_name, account_type_nameStringFrom silver_main_accounts
is_balance_sheet, is_pnlUInt8From the governed chart's statement_section
accounting_currency_amountDecimalSigned amount (debit − credit)
reporting_currency_amountDecimalD365's translated figure; 0 for submitted rows
transaction_currency_amount, transaction_currency_codeDecimal, StringTransaction currency
credit_amount, debit_amountDecimalSplit from the sign
posting_type, descriptionString
partner_data_area_idStringIntercompany partner, '' when none
dim_*StringOne column per declared dimension
journal_number, journal_category, document_number, document_date, posting_layerJournal header

Tests: assert_silver_gl_debit_credit_balance (error), assert_is_credit_retired, assert_fiscal_calendar_is_loaded.

silver_main_accounts​

What each account is, from one source: the group chart governed in konsol (Main Account, Published, non-group rows), written through to epm_staging.main_accounts (konsol#182). No ERP chart is read. An account not declared in konsol is not here, so its trial-balance rows reach neither statement; assert_undeclared_accounts_in_trial_balance (warn) names each one.

A pre_hook, governed_chart_guard(), refuses the build before the table is replaced when a Published declaration is unusable: duplicate rows that disagree, a statement_section or fx_method outside the vocabulary, a P&L account at the historical rate or a balance-sheet account at the average rate. When the table does not exist yet (konsol not upgraded) the model is empty with its full set of columns.

ColumnTypeDescription
main_account_idStringAccount code
account_nameString
account_type, account_type_nameStringkonsol's vocabulary: Revenue, Expense, Asset, Liability, Equity, Profit and loss, Balance sheet, Total
is_pnl, is_balance_sheetUInt8statement_section = 'Profit and Loss' / 'Balance Sheet'
is_equityUInt8account_type = 'Equity' (konsolidat#213: what the account is)
uses_historical_rateUInt8fx_method = 'historical' (konsolidat#213: what the chart declares about translation; a separate fact)
fx_methodStringclosing, average or historical; decides the rate gold_consolidated_trial_balance translates at
is_retained_earningsUInt8The account the year-end close posts the year's result to (konsolidat#199); 0 on a table that predates the column
main_account_category, debit_credit_default, chart_of_accounts, is_suspended, statement_section, sub_section, normal_balance, time_balance, is_posting, parent_account, allow_ic, cf_category, cf_line_item, is_cashThe rest of the declaration

Tests: assert_governed_chart_declarations_usable (warn, lists every problem), assert_governed_chart_grain_unique (warn), assert_every_account_is_pnl_or_balance_sheet (warn), assert_is_equity_is_account_type_equity.

silver_entity_currencies​

The currency each entity keeps its books in: anyIf(accounting_currency, != '') per data_area_id from epm_staging.entities (konsol's Entity master, is_group = 0), grouped so a duplicate row cannot fan a join out. No ERP fallback (konsolidat#255, decided 11 Oct 2026): a blank Functional Currency stays ''; consolidation joins only resolved currencies and assert_every_tb_entity_has_a_currency names an entity with trial-balance rows and none.

Columns: data_area_id, accounting_currency.

The ERP company master, from bronze_legal_entities. Columns: data_area, entity_name, accounting_currency, reporting_currency, party_number, country_region. Not read by the consolidation models since konsolidat#255.

silver_fiscal_periods​

Monthly periods generated from the ERP's fiscal calendar years (bronze_fiscal_calendar_years): twelve rows per year, addMonths(start_date, 0..11), while the month start is within the year. Read by silver_gl_entries and silver_budget_entries to date rows into periods.

Columns: calendar_id, fiscal_year_name, year_start_date, year_end_date, calendar_year, calendar_month, period_start_date, period_end_date, year_recid, period_recid (always 0).

konsol's own declared calendar is a different table, epm_staging.fiscal_periods (Regular and Closing periods), read by the gold models.

silver_financial_dimensions​

D365 dimension values that are not suspended, joined to their dimension definition: bronze_financial_dimension_values left join bronze_financial_dimensions, where is_suspended = 0.

Columns: dimension_name, dimension_value, value_description, dimension_description, is_suspended, active_from, active_to, dimension_is_active.

silver_exchange_rates​

The ERP's exchange-rate quotes as true rates, from bronze_exchange_rate_currency_pairs where exchange_rate > 0. Scaling (D365's ConversionFactor) is resolved once in the staging adapter (#138); this model never scales. For every quoted pair it also synthesizes the reciprocal (1.0 / rate, konsolidat#106) unless a direct quote for that from/to/valid_from/type already exists. Consolidation does not read this table: it translates only from the governed epm_staging.group_exchange_rates; these quotes pre-fill drafts in konsol.

Columns: from_currency, to_currency, valid_from, valid_to, exchange_rate (Float64), exchange_rate_type, recid (negative for a synthesized inverse).

Tests: assert_exchange_rate_positive, assert_exchange_rate_currencies_are_iso, assert_exchange_rate_sane_magnitude (warn), assert_conversion_factor_known.

silver_budget_entries​

ERP budget lines joined to their register header: bronze_budget_transaction_lines inner join bronze_budget_register_entries on budget_register_entry_recid = recid, keeping only posted budgets (budget_status in ('Completed', 'Approved', '2', '3')). Dated into fiscal periods through silver_fiscal_periods, falling back to the calendar year and month.

Columns: recid, data_area_id, transaction_date, fiscal_year, fiscal_period, main_account, accounting_currency_amount, transaction_currency_amount, transaction_currency, the budget dimensions, budget_model_id, budget_transaction_code, budget_status, register_date, include_in_cash_flow.

Read by gold_scenario_trial_balance as the BUDGET scenario (data_source = 'd365_budget').

silver_trial_balance​

The ERP's own fiscal-year trial-balance snapshot, from bronze_trial_balance_snapshot, with calculated_closing = opening_balance + debit_amount - credit_amount for validation. Not read by any gold model.

Columns: data_area_id, main_account, main_account_name, fiscal_year, opening_balance, debit_amount, credit_amount, closing_balance, currency_code, account_type, calculated_closing.

silver_tb_movements​

Every claimed trial-balance batch (bronze_trial_balance_submissions) normalised to period movements, the one shape the rest of the warehouse reads. konsol declares on each claim what the batch's amounts are (amount_basis), and this model undoes that shape once (konsolidat#199):

Declared basisMovement for period p
Period movementnet(p), where net = debit − credit
Year-to-date movementnet(p) − net(previous claimed period of the same fiscal year); first period of a year: net(p)
Period-end balancenet(p) − net(previous claimed period, any year); first claimed period: net(p)

Grain: (data_area_id, fiscal_year, fiscal_period, main_account, partner_data_area_id, the declared dimensions). The differencing runs within each dimension slice (konsol#255, commit 7f79109): an account split across two cost centres is two series.

Spine. A balance or YTD file lists only non-zero keys, so the model works on the entity's claimed periods × the entity's keys and reads a missing row as 0: a loan that vanishes from the file comes out as the repayment. Spine rows with movement 0 and no source row are dropped, so a Period movement batch comes out exactly as landed.

Year-end close. For every period-end-balance year that a later year follows, the model synthesizes a post-close period in the year's Closing period (epm_staging.fiscal_periods, period_type = 'Closing'): every P&L key (silver_main_accounts.is_pnl = 1) set to 0 and the retained-earnings account (is_retained_earnings = 1) increased by their sum, as one lump on the blank dimension key (decision of 23 Sep 2026, Deepak Pai, konsol#255: "one lump, no dimensions"; commit 58b7d61). The differencing then yields the closing entry there (movement_kind = 'year_end_close', batch_id = '', submission_name = 'Year-end close') and activity only in the next year's first period. Nothing is synthesized when the year has no Closing period after its last claimed period, the chart has no or several retained-earnings accounts, or the entity itself claimed a batch in the Closing period.

ColumnTypeDescription
data_area_id, fiscal_year, fiscal_period, main_account, partner_data_area_id, dim_*The key
amount_basisStringThe batch's declared basis
batch_id, submission_nameStringThe claimed batch the period came from ('' / Year-end close on a close row)
descriptionStringThe single distinct source description at the key, else ''
source_net_amountDecimal(38,2)Source debit − credit at the key; 0 on a spine row with no source
movement_amountDecimal(38,2)Per the table above
debit_amount, credit_amountDecimal(38,2)greatest(movement, 0), greatest(-movement, 0)
movement_kindStringactivity or year_end_close

Tests: assert_tb_movements_balance, assert_tb_movements_cumulate_to_source, assert_tb_movements_difference_within_dimension (all error), assert_entity_has_one_amount_basis (error), assert_year_end_close_declared (error), assert_year_end_close_invents_no_movement (error), assert_year_end_close_carried (warn).

Sources: bronze_trial_balance_submissions, silver_main_accounts, epm_staging.fiscal_periods.