Untitled
user_3592770
plain_text
8 months ago
1.2 kB
6
Indexable
(WITH
-- Calls answered by CEPAL within 60 seconds (ring time ≤ 60)
cepal_answered AS (
SELECT COUNT(DISTINCT dialerid) AS cepal_count
FROM `p-cdh`.primaryactive.dialer
WHERE ringtimeduration <= 60
AND talktimeduration >= 1
AND calltypecode = 'INBOUND'
AND IsActiveFlag = 'true'
),
-- Calls answered by external within 60 seconds of being presented the call
-- (after CEPAL didn't answer in 180 seconds, so total ring time 180-240)
ext_answered_within_60 AS (
SELECT COUNT(DISTINCT dialerid) AS ext_count
FROM `p-cdh`.primaryactive.dialer
WHERE ringtimeduration > 180
AND ringtimeduration <= 240
AND talktimeduration >= 1
AND calltypecode = 'INBOUND'
AND IsActiveFlag = 'true'
),
-- Total calls answered within effective 60 seconds (either by CEPAL directly
-- or by external within their 60-second window)
total_answered_60 AS (
SELECT
(SELECT cepal_count FROM cepal_answered) +
(SELECT ext_count FROM ext_answered_within_60) AS total_answered_60_count
),Editor is loading...
Leave a Comment