/build/static/layout/Breadcrumb_cap_w.png

Report of Total Tickets per Month for the Year

My boss wants a report with the total tickets per month for the year and for the life of me I have no idea how to manage that.  Has anyone had to do this before?  No need for categories or anything.  Simply raw numbers.


2 Comments   [ + ] Show comments
  • Could someone help modify this report so it will display it by queue as well? - jensenfox 9 years ago
  • How can I take the SQL code for this option above:

    Ticket Count by Owner (Current Year)

    and have it changed to:

    Ticket County by Category (Current Year)

    ?

    Every example I have found with suggestions to make changes to the code keeps resulting in SQL errors that the column doesn't exist. Any help would be greatly appreciated. - afort 8 years ago

Answers (4)

Posted by: jverbosk 11 years ago
Red Belt
1

Here's the main one I use, with owners listed.  The second one is a tweak that does not include the owners column.  If you need help tweaking it any further, just let me know.

Hope that helps!

John

________________________________

*Title*
Ticket Count by Owner (Current Year)

*Report Category*
Helpdesk (Custom)

*Description*
Lists ticket count by owner and status by month for current year.

*SQL Select Statement*
SELECT OPEN.OWNER, OPEN.MONTH, OPEN.YEAR, Coalesce(OPEN.OPEN, 0) AS OPENED, Coalesce(CLOSED.CLOSED, 0) AS CLOSED
FROM (SELECT Coalesce(U.USER_NAME, 'NO OWNER ASSIGNED') AS OWNER, 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 Coalesce(U.USER_NAME, 'NO OWNER ASSIGNED') AS OWNER, 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'
LEFT JOIN USER U ON T.OWNER_ID = U.ID
GROUP BY OWNER_ID, MONTH, YEAR
ORDER BY YEAR, MONTH) CLOSED
ON (OPEN.MONTH = CLOSED.MONTH AND OPEN.YEAR = CLOSED.YEAR AND OPEN.OWNER = CLOSED.OWNER )
WHERE OPEN.YEAR = date_format(curdate(), '%Y')
ORDER BY YEAR desc, str_to_date(OPEN.MONTH,'%M') desc, OWNER

*Break on Columns*
MONTH

________________________________

*Title*
Ticket Count (Current Year)

*Report Category*
Helpdesk (Custom)

*Description*
Lists ticket count by status by month for current year.

*SQL Select Statement*
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
GROUP BY 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 YEAR desc, str_to_date(OPEN.MONTH,'%M') desc


Comments:
  • Is there a way to take the ability to sort by month you have above, and add it to my own report I made with the wizard, replacing the interval section? - edwimb 11 years ago
  • Yes, it should be possible, but some things (like the date formats) may need to be tweaked to get things working.

    I'm providing the baseline and simplified versions of the reports below, to hopefully make transplanting what you want a bit easier. But if this is still not clear, try running the queries below and compare the T.CREATED value's format against what you get for MONTH and YEAR values. Then research the following date functions to get a better understanding of what they are doing and how they work:

    date_format()
    str_to_date()
    year()

    http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html
    ____________________________________________________

    baseline version without any date functions

    select T.CREATED,
    count(*) as OPEN
    from HD_TICKET T
    order by T.CREATED
    ____________________________________________________

    Simplified version - only tickets with an Open status

    select date_format(T.CREATED, '%M') as MONTH,
    YEAR(T.CREATED) as YEAR,
    count(*) as OPEN
    from HD_TICKET T
    group by MONTH, YEAR
    order by YEAR desc, str_to_date(MONTH,'%M') desc
    ____________________________________________________

    Simplified version - only tickets with an Open status for the current year

    select date_format(T.CREATED, '%M') as MONTH,
    YEAR(T.CREATED) as YEAR,
    count(*) as OPEN
    from HD_TICKET T
    where YEAR(T.CREATED) = date_format(curdate(), '%Y')
    group by MONTH, YEAR
    order by YEAR desc, str_to_date(MONTH,'%M') desc
    ____________________________________________________

    Hope that helps!

    John - jverbosk 11 years ago
Posted by: jdornan 11 years ago
Red Belt
0

I think this thread can help get you started. 

http://www.itninja.com/question/monthly-help-desk-ticket-report

Posted by: afort 8 years ago
White Belt
0
How would I take the Ticket Count by Owner (This Year) query and change it to a Ticket Count by Category (This Year) query? I have spent hours trying to get this to work after reviewing dozens of other examples with no luck. Thank you for any help you can provide.
Posted by: jensenfox 9 years ago
White Belt
0
Could someone help me modify this to separate the opened/closed by queue as well? 

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