Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
jaswanthchitra9
Contributor II
Contributor II

Ad-Hoc Creation

Hello Everyone,

 

I have one query which i'm using in stored procedure. i need to migrate that procedure into Ad-hoc code based on priority. please find the code below.

select
incidentid,
[DateTimeCreatedOn],
[Stat_DateTimeResolved],
I.priority,
540 + datediff(minute,[DateTimeCreatedOn],DATEADD(hour, 17, DATEDIFF(d, 0, [DateTimeCreatedOn]))) as date_diff_in_mintues,
smr.dbo.NetBusinessDaysHol([DateTimeCreatedOn], [Stat_DateTimeResolved], '8:00', '17:00', 0, 0, 0, '')/60,
CASE
WHEN I.priority =2 Then
Case
when cast([DateTimeCreatedOn] as date) = cast([Stat_DateTimeResolved] as date)
THEN 1
when datepart(hour,[DateTimeCreatedOn]) in(15,16) Then
Case when smr.dbo.NetBusinessDaysHol([DateTimeCreatedOn], [Stat_DateTimeResolved], '8:00', '17:00', 0, 0, 0, '')/60
<=( 540 + datediff(minute,[DateTimeCreatedOn],DATEADD(hour, 17, DATEDIFF(d, 0, [DateTimeCreatedOn])) ) )
THEN 1
Else 0 End
when datepart(hour,[DateTimeCreatedOn]) >=17 Then
case when smr.dbo.NetBusinessDaysHol([DateTimeCreatedOn], [Stat_DateTimeResolved], '8:00', '17:00', 0, 0, 0, '')/60 <=540 THEN 1
ELSE 0 END
Else 0 End
END AS Resolve_SLA_Met
From Cherwell.[dbo].[Incident_Final_Hist] I With (Nolock) where incidentid in ('2412763','2412550','2366140','1974128','1725767','1925192')

Thanks in Advance

Labels (1)
1 Reply
jaswanthchitra9
Contributor II
Contributor II
Author

can anyone give a reply for this query.