Operations & Supply Chain Analytics · Mission 8 of 30Easy

Top 5 SKUs by purchase value

Computed metric in ORDER BY, LIMIT N.

The Brief

Sarah LiuCFOslack-dm

For the spend review I need our top 5 SKUs by total purchase value across all received POs. Purchase value = `qty_received * unit_cost` per PO line, summed per SKU. Return sku_name and total_value (rounded to 2 decimals). Top 5 only, highest first.

You'll practice

Computed metricORDER BYLIMIT

Tables & columns available

fact_purchase_ordersfact12 columns
ColumnTypeKey
po_idINTPK
po_numberTEXT
sku_idINTFK → dim_skus
supplier_idINTFK → dim_suppliers
warehouse_idINTFK → dim_warehouses
order_dateTEXT
expected_arrivalTEXT
actual_arrivalTEXT
qty_orderedINT
qty_receivedINT
unit_costREAL
statusTEXT
dim_skusdim6 columns
ColumnTypeKey
sku_idINTPK
sku_codeTEXT
sku_nameTEXT
categoryTEXT
unit_costREAL
reorder_pointINT

Hints (3)

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

Hint 1

JOIN `fact_purchase_orders` to `dim_skus` ON `sku_id`. Filter `status = 'received'`.

Hint 2

Per-row value = `qty_received * unit_cost`. SUM that per SKU.

Hint 3

GROUP BY sku_name, ORDER BY total_value DESC, LIMIT 5. ROUND(SUM(...), 2).