Business Intelligence Path · Mission 6 of 25Easy

Discount tiers need a reality check

Use CASE WHEN to bucket continuous values into categories and aggregate by bucket

Back to Business Intelligence

The Brief

Marcus WebbVP of Salessales-ops

Finance is questioning our discount strategy. Can you bucket all sales into discount tiers — 'No Discount' for 0 or NULL, 'Low' for up to 10%, 'Medium' for 10-20%, and 'High' for over 20%? I need the tier name, number of sales, and total revenue for each tier. Sort by revenue descending.

You'll practice

CASE WHENNULL handlingBucketing

Tables available

fact_sales

Hints (3)

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

Hint 1

Use CASE WHEN to create discount tiers: check for NULL or 0 first, then ranges

Hint 2

Remember that NULL discount and 0 discount are different values but belong in the same business tier here

Hint 3

GROUP BY the CASE WHEN expression (or alias) to aggregate per tier