Healthcare Analytics Path · Mission 19 of 25Hard

Department utilization rates

Use subqueries, LEFT JOIN, COALESCE, and division with NULL handling

Back to Healthcare Analytics

The Brief

James HartwellVP of Operationsops-analytics

for each department with beds, show bed count, average daily census of admitted patients, and utilization rate (census / beds). include ALL departments even telemedicine — i want to see the zeros. use COALESCE so nulls show as 0.

You'll practice

SubqueryLEFT JOINCOALESCE

Tables available

dim_departmentsfact_encounters

Hints (3)

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

Hint 1

Patient-days = SUM of LOS per encounter. Daily census = patient-days / number of days in the period. Utilization = census / beds

Hint 2

Start from `dim_departments` with a LEFT JOIN so Telemedicine still appears. Guard against divide-by-zero when bed_count is NULL

Hint 3

`SELECT d.department_name, d.bed_count, COALESCE(___, 0) AS avg_daily_census, ROUND(avg_daily_census / NULLIF(d.bed_count, ___), 2) AS utilization_rate`