Omnichannel Retail Analytics Path · Mission 2 of 25Easy

Top stores by revenue

First JOIN: fact_orders to dim_stores. SUM aggregate over gross_amount, GROUP BY store, ORDER BY total DESC, LIMIT 10. The shape behind every regional director's dashboard.

Back to Omnichannel Retail Analytics

The Brief

Marcus ChenRegional Directorretail-ops

Quarterly review prep. Pull the top 10 stores by total gross revenue across all channels. Join fact_orders to dim_stores so I get readable store names. Three columns: store_id, store_name, gross_revenue. ROUND revenue to 2 decimals. ORDER BY gross_revenue DESC, store_id ASC for ties. LIMIT 10. Only orders with units > 0 — skip foot-traffic-no-purchase rows.

You'll practice

INNER JOINSUMORDER BY

Tables & columns available

fact_ordersfact10 columns
ColumnTypeKey
order_idINTPK
sku_idINTFK → dim_skus
store_idINTFK → dim_stores
channelTEXT
customer_zipTEXT
order_tsTEXT
unitsINT
gross_amountREAL
discount_amountREAL
fulfillment_costREAL
dim_storesdim7 columns
ColumnTypeKey
store_idINTPK
store_nameTEXT
regionTEXT
cityTEXT
stateTEXT
sq_ftINT
opened_dateTEXT

Hints (4)

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

Hint 1

INNER JOIN fact_orders to dim_stores on store_id.

Hint 2

Aggregate SUM(gross_amount) — round to 2 decimals with ROUND(SUM(...)::numeric, 2).

Hint 3

Filter units > 0 to skip foot-traffic-no-purchase rows.

Hint 4

GROUP BY store_id and store_name (both non-aggregated columns).