Marketplace Seller Analytics Path · Mission 10 of 25Medium

Refund rate by category

Conditional aggregation grouped by a denormalized dim attribute. Practice the same SUM/COUNT refund-rate pattern from M4 but joined through dim_listings to surface category-level signal — different cut, same skill.

Back to Marketplace Seller Analytics

The Brief

Mira CastellanosCustomer Experience Leadmarketplace-ops

Category review with the merchant team. Refund rate by category — same shape as M4 but cut by dim_listings.category instead of marketplace. Four columns: category, total_orders, refunded_orders, refund_rate_pct (rounded 1 decimal). Sort refund_rate_pct descending, category ascending. Apparel typically tops the refund rate in marketplace data — sizing returns are inherent to the category.

You'll practice

GROUP BYCOUNTOrder-by-volume

Tables & columns available

fact_ordersfact7 columns
ColumnTypeKey
order_idINTPK
listing_idINTFK → dim_listings
marketplace_idINTFK → dim_marketplaces
order_tsTEXT
unitsINT
gross_amountREAL
refundedINT
dim_listingsdim7 columns
ColumnTypeKey
listing_idINTPK
marketplace_idINTFK → dim_marketplaces
asin_or_listing_idTEXT
product_titleTEXT
categoryTEXT
list_priceREAL
current_statusTEXT

Hints (4)

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

Hint 1

JOIN dim_listings on listing_id to pull category.

Hint 2

GROUP BY l.category so the refund rate aggregates at the category grain.

Hint 3

SUM(refunded) for refunded count, COUNT(*) for total.

Hint 4

ROUND(100.0 * SUM(refunded) / COUNT(*), 1) AS refund_rate_pct.