Business Intelligence Path · Mission 9 of 31Easy

How many unique customers per region?

Use COUNT(DISTINCT) across joins and understand distinct counting in aggregation

Back to Business Intelligence

The Brief

Victoria ChenCEOslack-dm

I want to see regional rep coverage — for each region (include all of them), how many distinct sales reps have closed at least one deal there? Also show the total number of transactions and total revenue. I want all regions listed even if the count is zero.

You'll practice

COUNT DISTINCTJOINs

Tables & columns available

dim_regionsdim4 columns
ColumnTypeKey
region_idINTPK
region_nameTEXT
countryTEXT
timezoneTEXT
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

The brief asks for ALL regions — including any that haven't had sales activity. Think about which join type preserves rows from the left table even with no matching rows on the right. Check whether every region in the dimension table actually appears in the fact table.

Hint 2

COUNT(DISTINCT s.employee_id) gives you unique reps per region

Hint 3

Use COALESCE for the zero-sale region to avoid NULLs