Assets Values

Combines asset metadata with dated asset values into a consumable fact view.

Purpose

Provide a fully enriched, time-aware view of assets, combining asset metadata with their corresponding dated values.

This model joins asset-level amounts to their provider and currency context, producing a ready-to-use dataset for reporting, aggregation, and downstream financial analysis.

It serves as the asset fact view, avoiding repeated joins between asset values and metadata across the stack.

Business Logic

  • Start from the Assets Metadata transformations
  • Join asset metadata to Assets value facts by asset_id
  • Derive ISO week number from the asset date
  • Normalize missing asset values to zero

Output Contract

Definitions

ColumnDescription
dateDate of the asset value (YYYY-MM-DD). Links to Dates
weeknumISO year-week in YYYYWW format, derived from date
asset_providerName of the asset provider (e.g. Stripe, HSBC, Coinbase)
asset_idAsset unique identifier
currencyISO currency code associated with the asset
amountAsset value for the given date (defaults to 0 if missing)

Sample & Implementation

Asset values enriched with provider and currency metadata.
dateweeknumasset_providerasset_idcurrencyamount
2025-01-06202502Stripea1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5dEUR173668.52149344547
2025-01-06202502Internala3b4c5d6-e7f8-4a9b-0c1d-2e3f4a5b6c7dGBP1216910.5954889935
2025-01-06202502Internala5b6c7d8-e9f0-4a1b-2c3d-4e5f6a7b8c9dEUR444778.5879285391
2025-01-06202502Stripea7b8c9d0-e1f2-4a3b-4c5d-6e7f8a9b0c1dEUR454883.1580532345
2025-01-06202502HSBCa9b0c1d2-e3f4-4a5b-6c7d-8e9f0a1b2c3dUSD204706.47148478197
2025-01-06202502Revolutb0c1d2e3-f4a5-4b6c-7d8e-9f0a1b2c3d4eEUR81552.74252103463
2025-01-06202502PayPalb2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6eUSD99469.31890180029
2025-01-06202502Internalb4c5d6e7-f8a9-4b0c-1d2e-3f4a5b6c7d8eUSD835612.903264417
2025-01-06202502PayPalb8c9d0e1-f2a3-4b4c-5d6e-7f8a9b0c1d2eGBP219625.7490772042
2025-01-06202502Stripec1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5fCHF95336.68090536045
{{config(materialized='view')}}

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

asset_values as (
    select * from {{ref ('assets')}}
)

select
    av.date,
    EXTRACT(ISOYEAR from av.date) * 100 + EXTRACT(WEEK from av.date) as weeknum,
    am.asset_provider,
    am.asset_id,
    am.currency,
    COALESCE(av.amount,0) as amount,
from assets_metadata am
left join asset_values av on av.asset_id = am.asset_id
order by av.date, am.asset_id

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.