Business Intelligence Path · Mission 10 of 31Easy

Tag every sale by size

Combine CASE WHEN with multi-table JOINs and multiple aggregation levels

Back to Business Intelligence

The Brief

Rachel TorresCFOslack-dm

For the revenue-concentration review, classify every sale (grain: one row per sale) by deal size: 'Small' if revenue < 100, 'Medium' for 100–500, 'Large' for 500–2000, 'Enterprise' over 2000. Show the bucket, number of transactions, total revenue, and average revenue per deal. Sort by total revenue descending. I want to see how concentrated our revenue is — if Enterprise deals carry 40%+ of revenue on 5% of transactions, we have real customer-concentration risk and the board will ask about it.

You'll practice

CASE WHENMulti-table JOIN

Tables & columns available

fact_salesfact8 columns
ColumnTypeKey
sale_idINTPK
employee_idINTFK → dim_employees
product_idINTFK → dim_products
region_idINTFK → dim_regions
sale_dateTEXT
quantityINT
revenueREAL
discountREAL

Hints (3)

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

Hint 1

Use CASE WHEN on the revenue column to create deal size buckets

Hint 2

GROUP BY the CASE WHEN expression and compute COUNT(*), SUM(revenue), AVG(revenue)

Hint 3

Use ROUND on the average for cleaner output