Marketplace Seller Analytics Path · Mission 4 of 25Easy

Refund rate by marketplace

First conditional aggregation. Practice SUM(refunded) treating the 0/1 INT as boolean for counting, computing a percentage with explicit ROUND, and a 4-column output the customer-experience team can read.

Back to Marketplace Seller Analytics

The Brief

Mira CastellanosCustomer Experience Leadmarketplace-ops

Weekly CX review. Compute the all-time refund rate by marketplace. Four columns: marketplace_name, total_orders, refunded_orders (sum of fact_orders.refunded which is 0/1), refund_rate_pct (rounded to 1 decimal). Sort refund_rate_pct descending, marketplace_name ascending. Refund rate above 6% on any marketplace is the early warning we escalate.

You'll practice

Conditional aggregationRatioNULLIF

Tables & columns available

fact_ordersfact7 columns
ColumnTypeKey
order_idINTPK
listing_idINTFK → dim_listings
marketplace_idINTFK → dim_marketplaces
order_tsTEXT
unitsINT
gross_amountREAL
refundedINT
dim_marketplacesdim4 columns
ColumnTypeKey
marketplace_idINTPK
marketplace_nameTEXT
marketplace_fee_pctREAL
fba_supportedINT

Hints (4)

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

Hint 1

JOIN dim_marketplaces on marketplace_id.

Hint 2

SUM(refunded) gives the count of refunded orders since refunded is 0/1 INT.

Hint 3

ROUND(100.0 * SUM(refunded) / COUNT(*), 1) — the 100.0 forces float promotion.

Hint 4

Sort refund_rate_pct DESC, marketplace_name ASC.