April 15, 2025 at 2:49 pm
Hi,
Need this DAX covert SQL T-SQL.
Ticket Cutoff Status =
VAR TimeOnly = TIME(HOUR([Remedy Submitted Date]), MINUTE([Remedy Submitted Date]), SECOND([Remedy Submitted Date]))
RETURN
SWITCH(
TRUE(),
TimeOnly < TIME(13, 0, 0), "Prior to Cutoff",
TimeOnly >= TIME(13, 0, 0) && TimeOnly <= TIME(14, 0, 0), "Grey Zone",
TimeOnly > TIME(14, 0, 0), "Prior the Cutoff"
)
The Submit_Date is in EPOCH time/date.
I was able to figure some out for other columns but for time cut off I cannot figure that out!
For example:
CASE WHEN DATEDIFF(day, DATEADD("hh", -5, DATEADD("S", Submit_Date, 'January 1, 1970')),DATEADD("hh", -5, DATEADD("S", Completed_Date, 'January 1, 1970'))) >= 30 Then 'Yes'
WHEN DATEDIFF(day, DATEADD("hh", -5, DATEADD("S", Submit_Date, 'January 1, 1970')),DATEADD("hh", -5, DATEADD("S", Completed_Date, 'January 1, 1970'))) < 30 Then 'No'
END AS 'Over 30 Days'
So what I need is T-SQL code for:
Ticket submitted before 1 pm = 'Prior to Cutoff'
Between 1pm and 2 pm = 'Grey Zone'
After 2 pm = 'Past Cutoff'
Thank you,
Holly
April 15, 2025 at 8:37 pm
Hi,
Need this DAX covert SQL T-SQL.
Ticket Cutoff Status = VAR TimeOnly = TIME(HOUR([Remedy Submitted Date]), MINUTE([Remedy Submitted Date]),
SECOND([Remedy Submitted Date])) RETURN SWITCH( TRUE(), TimeOnly < TIME(13, 0, 0), "Prior to Cutoff",
TimeOnly >= TIME(13, 0, 0) && TimeOnly <= TIME(14, 0, 0), "Grey Zone"
, TimeOnly > TIME(14, 0, 0), "Prior the Cutoff" )
You do realize that the last "Prior the Cutoff" is actually after the cutoff, right?
--Jeff Moden
Change is inevitable... Change for the better is not.
April 15, 2025 at 9:28 pm
yes...there is a slight change to the policy. No worries.
Thank you for pointing that out and asked! 🙂
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply