This report gives us a count of positive, negative and neutral satisfaction ratings in the helpdesk per agent per month
SELECT DPQL_COUNT() FROM ticket_feedback
WHERE ticket_feedback.ticket_message.person.is_agent = 1
SPLIT BY DATE_FORMAT(ticket_feedback.date_created, '%Y-%m')
GROUP BY DPQL_MATRIX(REPLACE(REPLACE(REPLACE(ticket_feedback.rating, '-1', 'Negative'), '0', 'Neutral'), '1', 'Positive'), ticket_feedback.ticket_message.person)
Here we use DATE_FORMAT in the SPLIT BY clause to specify the timeframes we want to split by.*
In the GROUP BY we're using DPQL_MATRIX to allow us to group by both feedback rating and agent. We're also using REPLACE. This is because the value returned is numercal (Positive = 1, Negative = -1 and Neutral = 0) so we're replacing this to make it more readable:
Please log in or register to submit a comment.