Clinical Trials & Research Analytics Path · Mission 4 of 25Easy

Visit completion vs no-show

Aggregate on a boolean (0/1) flag column. Practice GROUP BY on an INTEGER flag, COUNT(*) per bucket, and the framing of completion/adherence reports — the daily heartbeat metric for any patient-retention team.

The Brief

Daniel ChoPatient Retention Analystslack-dm

Quick one for the morning standup. From fact_trial_visits, count visits grouped by completed_flag — completed_flag and visit_count, sorted ascending so the no-shows (flag=0) appear above the completed (flag=1). Two rows out. We track the ratio every morning and flag any week where the no-show share creeps above 10% — that's the early warning for protocol-level retention problems.

You'll practice

Boolean aggregationGROUP BY flagCOUNT(*)

Tables & columns available

fact_trial_visitsfact7 columns
ColumnTypeKey
visit_idINTPK
enrollment_idINTFK → fact_enrollments
scheduled_dateTEXT
actual_dateTEXT
visit_typeTEXT
completed_flagINT
days_off_scheduleINT

Hints (3)

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

Hint 1

Single-table aggregate over the entire visit log — no WHERE filter.

Hint 2

completed_flag is stored as INTEGER 0/1, not a string. Group on it.

Hint 3

Two output columns: the flag value and a row count named for the metric. Sort ascending so the flag-0 (no-show) bucket appears first.