← All case files
// case file
CASE / 03
Case Queue Report
SQLQUAWIN
NEEDS RESPONSEWAITINGSTALE FOLLOW-UPCASE 03SELF-SERVE CASE QUEUE
● In productioncase file · 03 / 16
Case
#03
Where
GM OnStar
Categories
Modeling · Optimization
Read
~2 min
/03

Self-Serve Case Queue Report Built on Two Window Functions

SQLQUALIFYWindow Functions
One parameter, three real-time queues, no Python and no dashboard team. Used by 15 analysts about 4 times a day, and picked up by the Level 3 team.
+
The Problem

Analysts had no consolidated, real-time answer to three questions: what needs a response now, what's gone stale without follow-up, and what's the full state of everything still open. The data was all in the CRM — it just wasn't shaped for triage, and auto-acknowledgment emails made "needs response" counts noisy.

Adoption
Used by15 analysts (~4 times a day) and the Level 3 team
BeforeManual navigation of the CRM to piece together each queue
NowThree real-time queues from one cloned notebook, no dashboard team
DecisionPure SQL, cloned per analyst rather than one shared notebook, so no analyst’s run affects another’s and non-engineers can maintain it.
How it's built

A pure-SQL notebook driven by a single :analyst_name parameter, cloned per analyst for isolated execution state. A UNION bridges current case status with full historical activity, and ROW_NUMBER / QUALIFY isolate the most recent activity per case without subquery nesting. Auto-acks are filtered by treating a short-window inbound right after an outbound as system-generated, and pure-SQL weekday arithmetic powers business-day stale-follow-up flags with no UDF or calendar table.

Technical Details
  • Single string parameter makes the notebook portable across analysts
  • QUALIFY replaces nested subqueries for "most recent per case"
  • Auto-acknowledgment filtering keeps "needs response" counts honest
  • Pure-SQL business-day arithmetic, no UDFs or calendar table
  • Inline CASE expressions derive urgency tiers automatically
15
Analysts
~4×
Opens per day
L3
Team also uses it