Passa al contenuto principale

How do I report tickets created per department since a given date? - Knowledgebase / Q&A / Reports & DPQL - Deskpro Support

How do I report tickets created per department since a given date?

Elenco degli autori
  • Kim

Create a custom stat with a DPQL query that counts tickets and groups them by department. You can also limit the report to certain departments by their ID.

Create the report

  1. Go to Reports > Stats and click Create Statistic.

  2. Open the Raw DPQL tab.

  3. Paste this query and change the start date:

SELECT DPQL_COUNT() AS 'Tickets created'
FROM tickets
WHERE tickets.date_created >= '2026-09-01'
AND tickets.status <> 'hidden'
GROUP BY tickets.department AS 'Department'
ORDER BY @'Tickets created' DESC
  1. Save the stat. Show it as a table or a bar graph.

How the report counts:

  • Tickets count under the department they're in now.

  • The status line leaves out spam and deleted tickets.

  • With a fixed start date, the report keeps counting up to the day you run it.

💡 Note: Dates are in UTC, so the start of the day may differ from your local time zone.

Limit the report to certain departments

Add this line to the WHERE section, with your department ID numbers. IDs keep working if you rename a department.

AND tickets.department_id IN (1, 2)

To find the IDs, create another stat with this query:

SELECT departments.id AS 'Department ID', departments.title AS 'Department'
FROM departments
WHERE departments.is_tickets_enabled = 1
ORDER BY departments.title ASC

The is_tickets_enabled line lists only ticket departments. Ticket and chat departments share one table and often have the same names. Without this line, you could pick a chat department's ID by mistake.

Utile Inutile