/build/static/layout/Breadcrumb_cap_w.png

K1000: Reporting tickets open and closed by month YTD

This custom SQL report will show the queue activity by month for YTD

Open and Close ticket info only.

SELECT OPEN.MONTH, OPEN.YEAR, Coalesce(OPEN.OPEN, 0) AS OPENED, Coalesce(CLOSED.CLOSED, 0) AS CLOSED
FROM (SELECT date_format(T.CREATED, '%M') AS MONTH, YEAR (T.CREATED) AS YEAR, COUNT(*) AS OPEN
FROM HD_TICKET T
LEFT JOIN USER U ON T.OWNER_ID = U.ID
GROUP BY OWNER_ID, MONTH, YEAR
ORDER BY YEAR, MONTH) OPEN
LEFT JOIN (SELECT date_format(T.TIME_CLOSED, '%M') AS MONTH, YEAR (T.TIME_CLOSED) AS YEAR, COUNT(*) AS CLOSED
FROM HD_TICKET T
JOIN HD_STATUS S ON HD_STATUS_ID=S.ID and S.STATE ='Closed'
GROUP BY MONTH, YEAR
ORDER BY YEAR, MONTH) CLOSED
ON( OPEN.MONTH = CLOSED.MONTH AND OPEN.YEAR = CLOSED.YEAR)
WHERE OPEN.YEAR = date_format(curdate(), '%Y')
ORDER BY str_to_date(OPEN.MONTH,'%M') ASC
 

The result is like this.


Comments

  • Hi, this works but its showing me multiple values for each month, like April is listed 16 times with the number for Opened different on each one but the Closed number always remaining the same. Do you know why/how to fix so it just shows one value for each month? Thanks. - twit 8 years ago
  • Ok never mind, figured it out. For anyone else using this and has the problem just take out GROUP BY OWNER_ID on the 5th line. Not sure why that was put there, possibly a mistake, as it makes it breakdown the month by owner but without indicating as such. Anyway remove that and you just get the stats, one line for each month. - twit 8 years ago
This post is locked

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ