Use EXTRACT(DOW), AVG with filtering, and a window function for baseline comparison
avg ED wait time by day of week. exclude the bad data over 480 min. also show an overall average across all days as a baseline column so i can see which days are above/below average. weekends are killing us — need proof.
Each hint you reveal reduces the XP you can earn. Try the query first.
Two data quality issues compound: the three ED name variants AND the impossible wait times over 480. Filter both before you aggregate
Group by day-of-week with `EXTRACT`, and add a window function with no partition to put the grand average on every row
`SELECT EXTRACT(___ FROM measurement_date::date) AS day_of_week, AVG(metric_value) AS avg_wait, AVG(AVG(metric_value)) OVER () AS overall_avg ... WHERE metric_value <= ___ AND department_name IN (___, ___, ___) GROUP BY ___`