Business Intelligence Path · Mission 7 of 25Easy

Which categories are actually selling well?

Use HAVING to filter aggregated groups and COUNT(DISTINCT) for unique counts

Back to Business Intelligence

The Brief

Priya NairHead of Productproduct-analytics

I need to know which product categories have more than 400 total sales transactions. For each qualifying category, show the category name (normalized), the number of distinct products sold, and total transaction count. I only want the busy categories — skip the quiet ones.

You'll practice

HAVINGCOUNT DISTINCT

Tables available

fact_salesdim_products

Hints (3)

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

Hint 1

Normalize category with LOWER() to avoid the casing split

Hint 2

Use COUNT(*) for total transactions and COUNT(DISTINCT product_id) for unique products

Hint 3

HAVING COUNT(*) > 400 filters after aggregation — WHERE cannot filter on aggregates