9 Replies Latest reply: Feb 9, 2017 1:26 PM by Sunny Talwar

# Calculated duration in minutes, less than or equal to specified value

I am trying to determine when a calculated duration is less than or equal to 30 minutes as a measure.

I tried using the following:

Count({\$<(InRoomTm-ArrWaitTm)*1440)={"<=\$(=30)"}>}(InRoomTm-ArrWaitTm)*1440))

but there is an error, with no output

&

Count(if(((PtInRoomTm-PtArrWaitTm)*1440) <=30, 1)) / count(all ((PtInRoomTm-PtArrWaitTm)*1440))

but the output is incorrect

Does anyone have a solution/fix to this?

• ###### Re: Calculated duration in minutes, less than or equal to specified value

Do you want to do a count here or Sum?? May be try something like this

Sum({\$<UniqueIdentifierField = {"=(InRoomTm-ArrWaitTm)*1440) <= 30"}>} (InRoomTm-ArrWaitTm)*1440)

• ###### Re: Calculated duration in minutes, less than or equal to specified value

Thank you @Sunny T! I believe its closer, but I'm still not getting the correct output.

I've put in:

Sum({\$<VisitNum = {"=(InRoomTm-ArrWaitTm)*1440) <= 30"}>} ((InRoomTm-ArrWaitTm)*1440))

But I'm getting an error message of "Bad field name: InRoomTm, ArrWaitTm" for the second instance of "...(InRoomTm-ArrWaitTm)*1440) "

Any thoughts? Not sure why it's not reading it since the expression is correctly formatted.

• ###### Re: Calculated duration in minutes, less than or equal to specified value

Seems like we left one extra parenthesis in the expression:

Sum({\$<VisitNum = {"=(InRoomTm-ArrWaitTm)*1440) <= 30"}>} ((InRoomTm-ArrWaitTm)*1440))

Try this:

Sum({\$<VisitNum = {"=(InRoomTm-ArrWaitTm)*1440 <= 30"}>} ((InRoomTm-ArrWaitTm)*1440))

• ###### Re: Calculated duration in minutes, less than or equal to specified value

It's still not reading that second instance of the calculation:

• ###### Re: Calculated duration in minutes, less than or equal to specified value

What exactly is InRoomTm and ArrWaitTm? Are these field names or are they variables

• ###### Re: Calculated duration in minutes, less than or equal to specified value

They are field names populated with times.

• ###### Re: Calculated duration in minutes, less than or equal to specified value

Would you be able to share a sample to take a look at the issue?

• ###### Re: Calculated duration in minutes, less than or equal to specified value

Let me know if this helps:

 VisitNum SchedDT ArrWaitTm InRoomTm 1 1/1/2017 7:22 7:30 2 2/1/2017 8:09 8:15 3 12/1/2016 8:06 8:50

I want to know both the count of how many visits had a wait time of 30 mins or less from arrival time (ArrWaitTm) to time seen (InRoomTm) & what that count is as a percentage of total number of visits.

• ###### Re: Calculated duration in minutes, less than or equal to specified value

Two methods

1)

=Sum({<Flag = {1}>}(InRoomTm - ArrWaitTm) * 1440)

2)

Sum({<VisitNum = {"=InRoomTm-ArrWaitTm <= MakeTime(0, 30)"}>}(InRoomTm - ArrWaitTm) * 1440)

For method one, I have created a flag in the script:

Table:

If(InRoomTm - ArrWaitTm <= MakeTime(0, 30), 1, 0) as Flag;