pepperwind / answer_key /kpis /first_reply_hours.sql
rasinmuhammed's picture
Pepperwind Trading Co. preview, version 1.0
27ec678 verified
Raw History Blame Contribute Delete
405 Bytes
-- Median hours to first reply
-- Median of first reply time less creation time, in hours, over tickets created in the month and replied to.
SELECT strftime(created_at, '%Y-%m') AS month, median(epoch(first_reply_at - created_at) / 3600.0) AS value FROM support.ticket WHERE first_reply_at IS NOT NULL AND created_at >= TIMESTAMP '2023-10-01' AND created_at < TIMESTAMP '2026-10-01' GROUP BY 1 ORDER BY 1