Query report for SLA report grouped by created time- (PGSQL )

Query report for SLA report grouped by created time- (PGSQL )

Tested in Build PGSQL (14300)


Go to Reports-New Query Report and execute this query.


SELECT to_char(to_timestamp(wo.CREATEDTIME/1000),'DD/MM/YYYY') "Created Time",
count(wo.WORKORDERID) "Total Request",
count(case when ( std.ispending='0') THEN 1 ELSE NULL END) "Closed",
count(case when ( std.ispending='1') THEN 1 ELSE NULL END) "Open",
count(case when (wos.IS_FR_OVERDUE='1') THEN 1 ELSE NULL END) "Response SLA violated",
count(case when (wos.ISOVERDUE='1') THEN 1 ELSE NULL END) "Resolution SLA violated",
count(case when (wos.IS_FR_OVERDUE='0') THEN 1 ELSE NULL END) "Response SLA not violated" ,
count(case when (wos.ISOVERDUE='0') THEN 1 ELSE NULL END) "Resolution SLA not violated" ,
case when count(wo.workorderid) > 0 then cast(count(case when (wos.IS_FR_OVERDUE='1') THEN 1 ELSE NULL END) *100 as float)   / cast(count(wo.workorderid) as float) else null end  "% Response SLA Violated",
case when count(wo.workorderid) > 0 then cast(count(case when (wos.ISOVERDUE='1') THEN 1 ELSE NULL END) *100 as float)   / cast(count(wo.workorderid) as float) else null end  "% Resolution SLA Violated",
case when count(wo.workorderid) > 0 then cast(count(case when (wos.IS_FR_OVERDUE='0') THEN 1 ELSE NULL END) *100 as float)   / cast(count(wo.workorderid) as float) else null end  "% Response SLA Not Violated",
case when count(wo.workorderid) > 0 then cast(count(case when (wos.ISOVERDUE='0') THEN 1 ELSE NULL END) *100 as float)   / cast(count(wo.workorderid) as float) else null end  "% Resolution SLA Not Violated" FROM WorkOrder wo
LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID
LEFT JOIN PriorityDefinition pd ON wos.PRIORITYID=pd.PRIORITYID
LEFT JOIN StatusDefinition std on wos.statusid=std.statusid
WHERE (wo.ISPARENT='1') AND (wo.is_catalog_template = 'false') AND wo.CREATEDTIME >= <from_thisweek> AND wo.CREATEDTIME <= <to_thisweek> GROUP BY  to_char(to_timestamp(wo.CREATEDTIME/1000),'DD/MM/YYYY')
order by 1

                    New to ADSelfService Plus?