E-commerce & Retail Analytics Path · Mission 4 of 30Starter

Drop the voided / refunded orders

Use a WHERE filter with NOT IN to exclude lifecycle states that don't represent revenue. Single COUNT to settle the 'how many real orders do we have' question that splits revenue from gross-orders reporting.

The Brief

Devon ParkSenior Analyst, Marketingecom-ops

The CFO and I are arguing about an order count. Marketing's slide says 100 orders YTD, finance's says less. The discrepancy is `voided` and `refunded` rows — they shouldn't count toward 'real' orders for the dashboard. Give me a single number: count of orders in `ecom_orders` that are NOT voided AND NOT refunded. Everything else (paid / partially_paid / pending / authorized / partially_refunded) stays in for now. We'll re-litigate `pending` next week.

You'll practice

WHEREFilters

Tables & columns available

ecom_ordersfact13 columns
ColumnTypeKey
order_idINTPK
customer_idINTFK → ecom_customers
order_numberTEXT
financial_statusTEXT
fulfillment_statusTEXT
total_priceREAL
subtotalREAL
taxREAL
shippingREAL
discount_totalREAL
channelTEXT
created_dateTEXT
processed_dateTEXT

Hints (3)

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

Hint 1

`stage NOT IN ('voided', 'refunded')` is the filter — both have to be excluded at once.

Hint 2

`SELECT COUNT(*) FROM ecom_orders WHERE financial_status NOT IN ('voided', 'refunded')` gets you there. One row, one column.

Hint 3

Note the question deliberately keeps `partially_refunded` IN the count — the order partially shipped, the customer paid, the partial-refund is a different line item conceptually. The CFO will revisit if the partial-refund total grows.