Video Screencast Help
Search Video Help Close Back
to help
Not able to make it to Vision this year? Get a sampling in the Best of Vision on Demand group.

Date Range for Category IT Metrics Report - Need Help

Updated: 06 Aug 2010 | 2 comments
FarmerTed's picture
0 0 Votes
Login to vote

I have a report that is detailed below, but I need to add a Date Range to get the correct totals.

SELECT T0.workitem_category_tree_value AS 'Category', COUNT(workitem_category_tree_value) AS 'Number of Incidents' FROM HD_workitem_current_view T0 
WHERE ((T0.workitem_category_tree_value LIKE '%CAP%'
OR (T0.workitem_category_tree_value LIKE '%ds%')
OR (T0.workitem_category_tree_value LIKE '%C%')
OR (T0.workitem_category_tree_value LIKE '%C2%')
OR (T0.workitem_category_tree_value LIKE '%Ap%')
OR (T0.workitem_category_tree_value LIKE '%Ac%')
OR (T0.workitem_category_tree_value LIKE '%VPN%')
OR (T0.workitem_category_tree_value LIKE '%P%')
OR (T0.workitem_category_tree_value LIKE '%A%')
OR (T0.workitem_category_tree_value LIKE '%o%')
GROUP BY T0.[workitem_category_tree_value]

I tried to use the article "Modify Reports to Use Date Range" from the site but receive "Conversion failed when converting datetime from character string" errors.
/*SET dateformat ymd     
DECLARE @StartDateTime DATETIME,         
@EndDateTime DATETIME         
SET @StartDateTime = CAST('%StartDateTime%' AS DATETIME)         
SET @EndDateTime = CAST('%EndDateTime%' AS DATETIME)*/

SELECT T0.workitem_category_tree_value AS 'Category', COUNT(workitem_category_tree_value) AS 'Number of Incidents' FROM HD_workitem_current_view T0 
WHERE ((T0.workitem_category_tree_value LIKE '%CAP%'
OR (T0.workitem_category_tree_value LIKE '%Ds%')
OR (T0.workitem_category_tree_value LIKE '%C%')
OR (T0.workitem_category_tree_value LIKE '%C2%')
AND T0.workitem_created_on BETWEEN '%StartDateTime%' AND '%EndDateTime%'))
GROUP BY T0.[workitem_category_tree_value]

I must be doing something stupid - but I cannot figure it out. Any help is appreciated.

Discussion Filed Under:

Comments

mgiblin's picture
05
Feb
2010
0 Votes 0
Login to vote

Try this SQL code:  You will

Try this SQL code:  You will need to create 2 Global parameters in the Altiris report generator.
Name = Start Date   Type = Date/Time  Prompt = Yes
Name = End Date    Type = Date/Time  Prompt = Yes

Here is the SQL code:

SELECT hd1.workitem_category_tree_value AS 'Category', COUNT(hd1.[workitem_category_tree_value]) as '# of Incidents'                   
FROM dbo.HD_workitem_current_view hd1                                                                       
WHERE                                                                
hd1.[workitem_modified_on] BETWEEN %Start Date% AND %End Date%                                                         
and hd1.[workitem_category_tree_value]  like '%How To%'      
or hd1.[workitem_category_tree_value]  like '%Break-Fix%'           
GROUP BY hd1.[workitem_category_tree_value]  
ORDER BY hd1.[workitem_category_tree_Value] ASC

I hope this will help you with the data range question.

Matt

 

JoeBolster's picture
05
Feb
2010
0 Votes 0
Login to vote

Is there a way to get

Is there a way to get the total of the incidents from%xx% and add them up to get a total of the incident from the combined categories?? 

example....%how to%            50 tickets
                     %Break-Fix%      50 tickets

Is there a way to add the two categories to get the 100?? This would be good to have for agrand total of all the tickets in a week...confusing?? I know...

I have been trying with SUM??