maiven gateway · online··
manifest · 1d ago
Sign in
Back to catalog
MAIVENmodelintermediate

int_promotions__order_join

intermediate ephemeral

Promo applications with order + segment context.

Definition

Per-(order × promotion) join. Computes `net_order_amount = max(gross - discount, 0)` (floors at 0 to handle the rare legacy data where discount exceeds the order subtotal). Carries customer segment and country for downstream slicing.

16 of 16
Column
Description
Tests · PII
order_promotion_id
From staging. Primary key.
order_id
From staging.
promotion_id
From staging.
promotion_code
From `stg_postgres__promotions.code` (LEFT JOIN).
discount_type
From `stg_postgres__promotions.discount_type` (LEFT JOIN).
discount_value
From `stg_postgres__promotions.discount_value` (LEFT JOIN).
discount_amount
From staging — actual money taken off this order.
applied_at
From staging.
applied_day
From staging.
customer_id
From `stg_postgres__orders.customer_id` (LEFT JOIN).
customer_segment
From `stg_postgres__customers.segment` (LEFT JOIN). Coalesced to `'unknown'`.
customer_country
From `stg_postgres__customers.country` (LEFT JOIN). Coalesced to `'unknown'`.
order_status
From `stg_postgres__orders.status` (LEFT JOIN).
gross_order_amount
Order subtotal BEFORE this discount. From `orders.total_amount`.
net_order_amount
Derived — `greatest(gross - discount, 0)`.
is_revenue_order
Derived — `order_status not in ('cancelled', 'refunded')`.