Calculate days to close each ticket (saas)
Convert Opened and Closed to dates and compute whole days between them; open tickets stay null.
- Level
- intermediate
- Time
- ~8 min
- Task
- Build the query
- Access
- Pro
Checking your access…
About this exercise
What you'll practise
Subtract dates to get a duration and extract days, letting nulls flow through.
The scenario, sample data, step list, hints and solution open with Pro. Grading checks your query against hidden data as well as the visible sample, so a query that only fits the sample doesn't pass.
Input
- Tickets (table)
- TicketID: text
- Opened: text
- Closed: text (nullable)
- Priority: text
- Channel: text
- Agent: text
- Topic: text
Expected output columns
TicketID (text), Opened (date), Closed (date (some rows null)), Days to Close (number (some rows null))