Skip to main content

FX Translation

How gold_consolidated_trial_balance translates an entity's trial balance into its group's reporting currency. Verified against dbt_project/models/gold/gold_consolidated_trial_balance.sql and macros/governed_rates.sql on 2026-11-05 (konsolidat 54d072a).

The rate source​

Translation reads one table: epm_staging.group_exchange_rates, written by konsol's Group Exchange Rate doctype. Decided 13 Sep 2026 (konsolidat#93, konsol#103):

  • Grain: (from currency, group reporting currency, fiscal year, fiscal period, rate type). Rate types are Closing and Average. Only rates into a group reporting currency are entered.
  • rate is the true rate, units of the to-currency per 1 unit of the from-currency. konsol divides out the "quoted per" factor before publishing. The warehouse never scales or inverts a rate.
  • The ERP feed (silver_exchange_rates) only pre-fills drafts in konsol. It no longer reaches this model.
  • Submit is the approval. Rates lock when their period closes.

There is no fallback. A translated currency without exactly one approved Closing and one Average rate for its period, each a positive finite number, stops the build. The first pre_hook of the model (governed_rate_guard()) raises before the scope's DELETE, so a missing rate leaves the table as it was. The throwIf in the model's consolidated CTE is the second line of defence. assert_every_translated_currency_has_a_governed_rate (warn) lists every missing, duplicate, invalid or implausible key. A rate more than 10x from the currencies' reference magnitudes (ISO Currency.usd_log10, macros/fx_magnitude.sql) counts as implausible.

The Closing-period rule (konsolidat#199)​

A period of type Closing in konsol's fiscal calendar (epm_staging.fiscal_periods) has no rates of its own. It translates at the same fiscal year's last Regular period's Closing and Average rates. The mapping is one macro, rate_period_map(), read by the guard, the coverage test, the deploy precheck and the model's rate join. A period the calendar does not know maps to itself.

Which rate each row uses​

The rate follows the account's declared fx_method in the group chart (konsol Main Account, via silver_main_accounts), not its statement (konsol#182):

case
when accounting_currency = reporting_currency then 1.0
when n_closing != 1 or n_average != 1 or n_invalid > 0 then null -- stops the build
when fx_method = 'historical' and historical_rate is not null then historical_rate
when fx_method = 'average' then gov_average
else gov_closing
end as translation_rate
fx_methodRate
historicalthe Historical Equity Rate (epm_staging.historical_equity_rates) whose rate_date is the latest on or before the period date, joined on the entity's owning group, entity and account (an ASOF join). Before the first tranche: the Closing rate
averagethe period's Average rate
closing, or an undeclared accountthe period's Closing rate

A P&L account may be declared closing (IAS 29). A P&L account declared historical, or a balance-sheet account declared average, is refused when the chart is published and again by governed_chart_guard() before silver_main_accounts is replaced.

Two chart facts travel with each row and must not be confused (konsolidat#213): is_equity says what the account is (account_type = 'Equity'); uses_historical_rate says what the chart declares about translation (fx_method = 'historical').

Ownership​

Ownership comes from gold_entity_ownership, one row per ancestor group, entity and period, already a fraction and already dated (F2). The join fans each entity row out to every group that consolidates it. Rows whose resolved method is equity or none, or whose chain is incomplete, are excluded here; the equity-method entity is handled by gold_equity_method_associates.

Output columns​

local_amount = period_debit − period_credit (signed; the local TB sums to zero)
translated_amount = local_amount × translation_rate + retranslation_amount
group_amount = translated_amount × ownership_pct
nci_amount = translated_amount × (1 − ownership_pct)

closing_rate and average_rate are carried on every row for audit; historical_equity_rate is carried where one applied. partner_data_area_id rides through so the intercompany models can pair sides. The model is incremental by period and scope: the pre-hooks delete the run's slice, the select appends it.

Balance-sheet retranslation (konsolidat#257)​

A balance-sheet balance is translated at the closing rate of each reporting date (IAS 21.39(a)), not as the sum of each period's movement at that period's rate. The model keeps the movement grain and adds retranslation_amount to the rows of a non-equity balance-sheet account declared closing (or undeclared):

retranslation_amount(p) = cum_local(p − 1) × (closing(p) − closing(p − 1))

so the translated movements summed to period p equal cum_local(p) × closing(p). A key whose balance did not move in a period gets a filler row with local_amount = 0 to carry the retranslation. Equity is never revalued (decided on #257 Q2, 6 Oct 2026): retranslating it would bury the exchange difference in equity lines and leave nothing to recycle on disposal.

Year-end close (konsolidat#259)​

For a period-end-balance file, silver_tb_movements closes the year in the Closing period: each P&L key is reversed and the result moves into the retained-earnings account (is_year_end_close = 1). The close moves amounts that are already translated, so the model adjusts those rows (in the same retranslation_amount column) so that the close period's translated rows net to zero and its CTA is 0 by construction. Decided by Deepak Pai, 6 Oct 2026 (option #259-1).

Tests​

TestSeverityProves
assert_translation_follows_fx_methodwarnevery translated row's translation_rate is the rate its fx_method names
assert_translated_amount_formulaerrortranslated_amount = local_amount × translation_rate + retranslation_amount within 0.01
assert_group_amount_formulaerrorgroup_amount = translated_amount × ownership_pct within 0.01
assert_bs_translated_at_closing_rateerrora closing-rate balance-sheet key's translated movements summed to p equal the local balance × closing(p)
assert_equity_never_revaluederroron every is_equity = 1 row, translated_amount = local_amount × translation_rate
assert_equity_uses_historical_rateerroran account declared historical with a covering rate translates at it
assert_historical_is_equity_onlyerrorfx_method = 'historical' is declared only on equity accounts
assert_translation_rate_resolvederrorno row carries a 0 or NULL rate
assert_every_translated_currency_has_a_governed_ratewarnnames every translated key with no usable governed rate, and why
assert_equity_rate_coveragewarnan entity node with equity but no Historical Equity Rate at all
assert_declared_historical_has_a_ratewarnan account declared historical in a period no rate covers (it translated at the closing rate)
assert_undeclared_accounts_in_trial_balancewarnaccounts a trial balance posts to that the chart does not declare

Out of scope​

  • Remeasurement (IAS 21 non-monetary items at the rate of the day they arrived). konsol translates and does not remeasure, which is why historical is an equity-only declaration.
  • A reporting-basis override of a group's presentation currency, and step-by-step sub-consolidation in a sub-group's own currency (konsolidat#93 Phase 2, deferred).

Source files​

  • dbt_project/models/gold/gold_consolidated_trial_balance.sql
  • dbt_project/macros/governed_rates.sql (rate_period_map, governed_rate_guard, fx_precheck)
  • dbt_project/macros/fx_magnitude.sql, dbt_project/macros/governed_chart.sql
  • konsol: konsol/consolidation/doctype/group_exchange_rate, konsol/group_rates.py, konsol/consolidation/doctype/historical_equity_rate, konsol/epm/doctype/main_account