Quick Commerce Analytics Path · Mission 9 of 25Medium

Basket size by customer cohort

Join a fact to a dimension and average a metric across an acquisition cohort. First INNER JOIN of the path, tying order behavior back to how the customer was acquired.

Back to Quick Commerce Analytics

The Brief

Hannah KimGrowth Leadgrowth

I want to know whether the channel we acquire a customer through predicts how big their baskets are. Join fact_orders to dim_customers and average units per delivered order, grouped by acquisition_channel. Only delivered orders. Columns: acquisition_channel, avg_basket_size (2 decimals), order_count. ORDER BY avg_basket_size DESC, acquisition_channel ASC.

You'll practice

INNER JOINAVGCohort

Tables & columns available

fact_ordersfact18 columns
ColumnTypeKey
order_idINTPK
customer_idINTFK → dim_customers
merchant_idINTFK → dim_merchants
shopper_idINTFK → dim_shoppers
dispatch_idINTFK → fact_shopper_dispatches
order_tsTEXT
order_statusTEXT
unitsINT
item_subtotalREAL
delivery_feeREAL
service_feeREAL
surge_feeREAL
surge_multiplierREAL
tip_amountREAL
customer_totalREAL
shopper_takeREAL
platform_takeREAL
merchant_payoutREAL
dim_customersdim8 columns
ColumnTypeKey
customer_idINTPK
emailTEXT
first_nameTEXT
last_nameTEXT
cityTEXT
stateTEXT
signup_dateTEXT
acquisition_channelTEXT

Hints (3)

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

Hint 1

INNER JOIN fact_orders to dim_customers on customer_id to reach acquisition_channel.

Hint 2

Restrict to order_status = 'delivered' so cancellations don't drag the average.

Hint 3

GROUP BY acquisition_channel, ROUND(AVG(units), 2), and COUNT(*) for order_count.