Reporting Rates

Provides a reporting-ready view of exchange rates with normalized currency pairs.

Purpose

Provide a reporting-friendly view of exchange rates, exposing both direct and inverse currency pairs in a single, consumable dataset.

This model standardizes exchange rate data so downstream models and reports can convert between currencies without needing to handle pair directionality or rate inversion logic.

Business Logic

  • Start from the Exchange Rates fact table
  • Resolve currency pairs into base and quote currencies
  • Translate internal currency identifiers into ISO currency codes
  • Derive ISO week number from the rate date
  • Generate inverse rates automatically:
    • Swap base and quote currencies
    • Invert the exchange rate value
  • Combine direct and inverse rates into a single result set

Output Contract

Definitions

ColumnDescription
dateDate of the exchange rate (YYYY-MM-DD). Links to Dates
weeknumISO year-week in YYYYWW format, derived from date
base_currencyISO currency code being converted from
quote_currencyISO currency code being converted to
valueExchange rate value from base_currency to quote_currency

Sample & Implementation

Exchange rates expanded for reporting and currency conversion.
dateweeknumbase_currencyquote_currencyvalue
2025-11-24202548EURUSD1.15114435
2025-11-24202548GBPUSD1.30904018
2025-11-24202548EURGBP0.87938046
2025-11-24202548EURCHF0.93101927
2025-11-24202548USDCHF0.80877716
2025-11-24202548GBPCHF1.0587218
2025-09-29202540EURUSD1.17221272
2025-09-29202540GBPUSD1.34264673
2025-09-29202540EURGBP0.87306117
2025-09-29202540EURCHF0.93365481
{{ config (materialized='view') }}

with exchange_rates as (
    select * from {{ ref('exchange_rates') }}
),

currency_pairs as (
    select * from {{ ref ('currency_pairs') }}
),

currencies as (
    select * from {{ref ('currencies') }}
),


rates as (
select
    er.date,
    EXTRACT(ISOYEAR FROM er.date) * 100 + EXTRACT(WEEK FROM er.date) as weeknum,
    c1.currency_code as base_currency,
    c2.currency_code as quote_currency,
    er.value
from exchange_rates er
join currency_pairs cp on er.currency_pair_id = cp.id
join currencies c1 on cp.base_currency_id = c1.id
join currencies c2 on cp.quote_currency_id = c2.id
),

inverse_rates as (
    select
        date,
        weeknum,
        quote_currency as base_currency,
        base_currency as quote_currency,
        1/value as value
    from rates
)

select * from rates
union all
select * from inverse_rates

Dependencies

On this page

Star us on GitHub

If you enjoy this content and find it useful, give us a star on GitHub to show your support and stay updated with our latest improvements.