Login to participate
Endpoint Management & Virtualization ArticlesRSS

Advanced Report for Helpdesk

DeborahAlbrecht's picture

For all of those mangers who want to know…this report will help give an overview of incidents for your different queues. It will return information that will allow management to review individual users who work within a specific queue (global parameter) over a period of time (global date parameters). I created this previously to allow management to review incidents completed over a date range for review/bonus purposes.

Creating a report that will return the following:

  • Queue name
  • Worker Name
  • Average number of incidents for a queue
  • Count of the total for the queue
  • Count of per worker incidents within that queue
  • Difference between the queue total and the Worker total
  • Percentage of completed incidents for that Worker relative to his/her other queue members

Global parameters:

  • Begindate
    • Parameter Type: Date/Time
    • Settings: Type: Short Date
  • Enddate
    • Parameter Type: Date/Time
    • o settings: Type: Short Date
  • Team
    • Parameter Type: Dropdown
    • User Prompt: Team Name
    • List Type: Query Results
      • You could also do a fixed list if you wanted to simply list the queue names, however, this does not allow for growth
    • Value Type: String
    • Value: select distinct queue_name from dbo.HD_worker_view where queue_name IS NOT NULL
      • Here you can also please and AND queue_name LIKE ‘%’ if you have specific teams you want to build this for only.

SQL Statement:

SELECT         
 wrkr.queue_name AS 'Team',         
 wrkr.worker_name AS 'Worker Name',         
 abc.TeamAverage,      
 abc.TeamIncidents,         
 COUNT (*) AS 'Indiv. # of incidents',         
 COUNT (*) - abc.TeamAverage AS 'Difference',         
 (cast(COUNT (*) as money) / cast(abc.TeamIncidents as money)) * 100 as '% for individual'         

FROM dbo.HD_workitem_current_view hd1         
INNER JOIN dbo.HD_worker_view wrkr          
 ON hd1.[workitem_assigned_to_worker_id] = wrkr.[worker_id]         
INNER JOIN         
(         
 SELECT         
  queue_name,         
  count(queue_name) AS 'number_in_queue'         
 FROM dbo.HD_worker_view wrkr         
 WHERE          
  [queue_name] IS NOT NULL         
  AND (wrkr.[queue_name] LIKE %team%)    
 GROUP BY [queue_name]         
) X         

 ON X.[queue_name] = wrkr.[queue_name]      
   
INNER JOIN         
(          
 SELECT         
  wrkr.queue_name as 'queue',         
  COUNT(wrkr.queue_name) / X.number_in_queue AS 'TeamAverage',         
  COUNT (*) AS 'TeamIncidents'         
 FROM dbo.HD_workitem_current_view hd1         
 INNER JOIN dbo.HD_worker_view wrkr          
  ON hd1.[workitem_assigned_to_worker_id] = wrkr.[worker_id]      
   
 INNER JOIN         
 (         
  SELECT         
   queue_name,         
   count(queue_name) AS 'number_in_queue'         
  FROM dbo.HD_worker_view wrkr         
  WHERE [queue_name] IS NOT NULL         
   AND (wrkr.[queue_name] LIKE %team%)    
GROUP BY [queue_name]         
 ) X         

  ON X.[queue_name] = wrkr.[queue_name]    
     
 WHERE  hd1.[workitem_created_on] between %begindate% AND %enddate%    
  AND hd1.[workitem_status_lookup_value] = 'Closed'         
  AND (wrkr.[queue_name] LIKE %team%)    

GROUP BY          
  wrkr.queue_name,          
  X.number_in_queue         
) abc         

 ON abc.queue  = wrkr.queue_name      
   
WHERE  hd1.[workitem_created_on] between %begindate% AND %enddate%         
 AND hd1.[workitem_status_lookup_value] = 'Closed'         
AND (wrkr.[queue_name] LIKE %team%)    

GROUP BY          
 wrkr.queue_name,          
 X.number_in_queue,         
 wrkr.worker_name,         
 abc.TeamAverage,         
 abc.TeamIncidents         

ORDER BY wrkr.queue_name, count(*) desc

shogo's picture

I cant get it working

Do i only have to paste this in a empty report, in enter SQL directly, or what do i have to do?

mboggs's picture

Worked for me

Did you add the Global Parameters also? Caution, they are case sensitive.

Worked fine for me! Great article! Thanks!

shogo's picture

Can you post a export of the report?

[quote=mboggs]Did you add the Global Parameters also? Caution, they are case sensitive.

Worked fine for me! Great article! Thanks! [/quote]

Can you please do a export of the report and post it so i can se how you have solved the global parameters please.

jongolf07's picture

Versions SQL / NS

I couldn't get it to work either.
What version of NS are you running?
what about SQL?
We are at 6.0.6074 (sp3 r6)
running on SQL 2000 sp4

mboggs's picture

Version and Parms

I am running SQL 2000 as well and NS is 6.0.6074 sp3 r7.

Mine is the same as the original article except I used Mixed case for the Global Parameters and had to make those changes in the SQL statement.

Look for %team% or %begindate% or %enddate% within the SQL. Those are the parms and the name and case has to match what you use when you create the Global parms as you create the report.

jongolf07's picture

Version and Parms

Alright.
I changed the case to lower case in the parameters and it still didn't work. However, when I copied the parameter name it copied a space at the end of the name. I took that space out and it worked great!
Thanks! and sory for the hassle.

caseki's picture

Version and Parms

When coping the SQL syntax from the sample be sure that the last line is: ORDER BY wrkr.queue_name, count(*) desc

at first I made that classic misstake and copied too much from this page and "run into wall"...but now it is working just fine.

Special thanks to the author of this article!

DeborahAlbrecht's picture

Version info

I am running 6.0.6074 SP3 R7
SQL 2005

But neither of these should hinder the report from running if the global parameters have been entered and referenced correctly.

-d

-d

DeborahAlbrecht's picture

exporting requests

I would export and attach my report, however, we have made many customizations which I took out of the SQL so that would just cause more issues that helping you.

Make sure all of your parameters are correctly cased (capital or lower case) in the global as well as in your SQL when you call them. That is very important.

You can send me your report and I can take a look at it for you if you like.

-d

-d

hermant's picture

No team names

The report keeps spitting back there are no team names.  I have five different queues in the helpdesk but it is not finding any of them.  Also when I go into the tables In Worker I find queue_id but I do not see any queue_name.

any help would be awesome.

hermant's picture

got it past team names now stuck begin date

I had to modify the string this works for me

USE ALTIRIS_INCIDENTS
select distinct queue_name
from dbo.worker_view
where queue_name IS NOT NULL

now its getting stuck on running the report.  the sql code is poping back saying

  Sql error in query. Error: System.Data.SqlClient.SqlError: Incorrect syntax near 'begindate'.

It shows all the code after that statement.

hermant's picture

begin/enddate paramaters

Ok I figured out that the begin / end date paramaters are not feeding the dates in correctly.  In SQL server 2005 with static veriable inputed for the team and dates the report is running.  The problem is the input of the variables in Altiris.  I'll keep working to try and figure out.