Healthcare Analytics Path · Mission 12 of 25Medium

ED throughput — the real numbers

Use CASE WHEN to bucket values, filter bad data, and join multiple tables

Back to Healthcare Analytics

The Brief

Rita VasquezDirector of Patient Experiencepatient-experience

I need ED throughput broken into wait time buckets: under 30 minutes, 30 to 60, 60 to 120, and over 120. Count encounters in each bucket. But first — filter out any wait times over 480 minutes. Those have to be data entry errors. I need real numbers for the nursing leadership meeting.

You'll practice

CASE WHENMulti-JOINBucketing

Tables available

fact_quality_metricsfact_encountersdim_departments

Hints (3)

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

Hint 1

Three tables connect here: the metric, the encounter, the department. Remember from Mission 4 — the ED is split across three department names

Hint 2

Bucket the numeric wait with a conditional expression in the SELECT, then GROUP BY that bucket. Drop the impossible outliers before bucketing

Hint 3

`CASE WHEN metric_value < 30 THEN 'Under 30 min' WHEN metric_value < ___ THEN '30-60 min' WHEN metric_value < ___ THEN '60-120 min' ELSE ___ END AS wait_bucket` — filter with `metric_value <= ___ AND department_name IN (___, ___, ___)`