Subscription Commerce Analytics Path · Mission 8 of 25Medium

Blended revenue: subs MRR plus one-time orders

First two-fact aggregation. Practice computing two metrics from two different fact tables (subscription MRR from snapshots, one-time revenue from orders) and combining them into one output row. UNION ALL is the cleanest pattern; some analysts prefer scalar subqueries — both work.

The Brief

Eleanor VossCFOsubscription-ops

Monthly close — give me 2026-03 blended revenue: subscription MRR (from latest snapshot in the month, active state only) plus one-time order revenue (orders dated in 2026-03). Four columns in one row: month ('2026-03'), mrr_revenue, one_time_revenue, total_revenue (sum of the two). Round all monetary columns to 2 decimals.

You'll practice

UNION ALLTwo-fact joinAggregate

Tables & columns available

fact_subscription_snapshotsfact7 columns
ColumnTypeKey
snapshot_dateTEXTPK
subscription_idINTPKFK → fact_subscriptions
customer_idINTFK → dim_customers
stateTEXT
plan_idINTFK → dim_plans
mrrREAL
paused_untilTEXT
fact_one_time_ordersfact6 columns
ColumnTypeKey
order_idINTPK
customer_idINTFK → dim_customers
ordered_atTEXT
sku_idINTFK → dim_skus
qtyINT
total_amountREAL

Hints (4)

Each hint you reveal reduces the XP you can earn. Try the query first.

Hint 1

Two facts, one output row. Easiest pattern: scalar subqueries for each metric inside the SELECT.

Hint 2

MRR = SUM(mrr) from fact_subscription_snapshots WHERE snapshot_date = '2026-03-31' AND state = 'active'.

Hint 3

One-time = SUM(total_amount) from fact_one_time_orders WHERE ordered_at BETWEEN '2026-03-01' AND '2026-03-31'.

Hint 4

total_revenue = mrr_revenue + one_time_revenue. Do the addition once; don't recompute the subqueries.