A seven-step workflow that turns "which customers should Marketing target?" into a reusable activity layer plus a segment model, materialized into your dev schema. Two-model design on purpose: the activity layer is testable and reusable so downstream work does not re-derive the same aggregates.
Watch the campaign-audience workflow play through end-to-end. Seven steps, builds a reusable activity layer plus the segment model, roughly two minutes.
Marketing asks: which customers should we target? You'll build a reusable activity layer plus a segment model on top of it, instead of writing a one-off query that nobody can re-use.
The two-model design is the point. Churn models, RFM models, executive dashboards - all of them can sit on the activity layer instead of re-deriving the same aggregates in five different places. That's the difference between an analytics-engineering practice and a pile of one-off queries. By the end you'll have a campaign audience that lives as a queryable, versioned table - not a screenshot of a query somebody ran once.
Customers can belong to multiple segments. The model tags or unions rows so a single customer can appear with multiple segment_name values - that's the business definition, not a bug.
avg_transaction_value > $100 AND transaction_count >= 3
The customer who shows up regularly and spends meaningfully every time.
max_transaction_value > $300
A single transaction over $300 puts them in this segment - independent of frequency.
category_transaction_count >= 10 for any single category
The customer who keeps coming back for the same category - perfect for targeted merch campaigns.
Copy each prompt as written (recommended) or rephrase in your own words. Run the steps in order; do not skip ahead.
Six entity types - wider than the other scenarios - which is exactly why discovery has to happen before any SQL.
Find the models related to customers, stores, orders, order lines, products, and categories.
Then ask for grain and joins.
Show the grain and joins for those models.
Check three things when the response returns: where category actually lives (product level, order-line level, or order header), the grain of orders versus order lines, and whether store is on the order, on the customer, or on both.
Check recent order dates and category values needed for a 180-day segmentation model.
Two silent bugs to watch for: a stale max(order_date) that quietly shrinks the 180-day window, and a category field with nulls, whitespace, or mixed case that breaks category-loyal logic later.
Create a 180-day customer activity model by store.
current_date or on max(order_date). If categories are dirty, decide on exclude-versus-coalesce now.
The reusable intermediate model - not the segment model yet. Per-customer x store aggregates over the trailing 180 days: transaction_count, avg_transaction_value, max_transaction_value, and category_transaction_count at customer x store x category grain.
Create a segment model for VIPs, big spenders, and category-loyal customers, built on top of the activity model.
Built on top of the activity layer. Expected columns: customer identifier, store_name, segment_name, transaction_count, avg_transaction_value, max_transaction_value, category, category_transaction_count. Verify multi-segment logic and confirm thresholds match the definitions above.
Compile and preview the segment model. Exclude customers with no segment.
The SQL compiles, sample rows render, nothing lands in the warehouse yet. The "exclude no segment" filter doubles as a data-quality check: if a large share of customers fall out, the thresholds or the date window need a second look before Marketing ever sees the list.
Materialize the segment model into my dev schema. Skip the verification pass - the preview already confirmed the output.
dbt Wizard runs the build against your dev schema (dev_lab_user_N). The instructor drops dev schemas after the lab via a cleanup script, so this build is safe and reversible.
The "skip the verification pass" instruction is deliberate: the Step 6 preview already validated the output, and re-running a full verification pass would burn roughly 10% of a 20-minute lab on duplicate work.
The canonical scenario-3 skill definition, prompts, and instructor notes.
One-page lab handout with every prompt in this scenario, formatted for print.
Broken model from a source column rename. Choose-your-path: products, orders, or customers.