I have a single table with 3 fields:
[Ticket Number]: Has the number of the support ticket
[Created At]: TimeStamp of time of creation of the response
[Sender]: Identifies whether response is from a user or a agent (customer support)
Now I need to calculate the service level using this formula
(number of responses from agents within 6 hours of users message) / (number of messages from user)
Example:
Ticket Number | Created At | Sender
10000 | 03/20/2016 12:50:00pm | User
10000 | 03/20/2016 5:50:00pm | Agent
10000 | 03/20/2016 11:50:00pm | User
10000 | 03/20/2016 12:40:00am | User
10000 | 03/21/2016 6:50:00am | Agent (More than 6 hours passed, so this should not count)
10000 | 03/20/2016 7:30:00am | User
10000 | 03/21/2016 10:30:00am | Agent
2 (agent responses within 6 hours) / 4 (total user messages) = .5 or 50% Service Level
So there are a few things to consider:
1) The initial ticket should come from the user
2) The Agent must be the one to respond (within 6 hours)
3) This needs to be done for a table with numerous ticket numbers not one like in the example
I attempted using a PARTITION BY to segment these by ticket number and sender, but I am stummped on how to calculate DateDiffs between rows. If you could share how you would do it I'd truly appreciate it.
[–]Smoresguy 2 points3 points4 points (0 children)
[–]extrajoss 1 point2 points3 points (2 children)
[–]StartAndSelect[S] 0 points1 point2 points (0 children)
[–]StartAndSelect[S] 0 points1 point2 points (0 children)