Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Can someone tell me what is wrong with this expression?
=Sum(If(Timestamp(StartTime)>'6/2/2010 1:00:00 AM')Round((Timestamp(EndTime)-Timestamp(Start_Interval))*24,0.01))
Thanks
=Sum(If(Timestamp(StartTime)>'6/2/2010 1:00:00 AM',Round(Timestamp(EndTime)-Timestamp(Start_Interval))*24,0.01))
Not sure what your requirement is but try above.
=Sum(If(Timestamp(StartTime)>'6/2/2010 1:00:00 AM',Round(Timestamp(EndTime)-Timestamp(Start_Interval))*24,0.01))
Not sure what your requirement is but try above.
I see lots wrong with it, but it's hard to fix it without being able to test or knowing what you wanted it to do. Maybe this?
sum(if(StartTime>makedate(2010,2,6)+1/24,round((EndTime-StartInterval)*24,0.01)))
Thanks, That works.
Sorry I did not give more detail. When I first started explainig I started to write a novel. I figured it was just a simple syntax problem and I would just confuse the situation.
Here is what I am trying to do: I have a table with three columns, PatientID, StartTime, EndTime. StartTime is the time the patient was admitted, EndTime was the time discharged. I need to find out how many hours patients were in the hospital within each day (Start_Interval - End_Interval). This expression was the beginning of that expression. Here is were it gets fun. I want to see the patient hours for 6/2/2010 12:01 AM to 6/3/2010. Patient A was in the hospital from noon 6/1 until noon 6/2. This is a total of 24 hours for the patient but only 12 hours between the start and stop interval (Patient Day). Patient B was admitted 6/2 at noon and discharged 6/2 at 5:00 PM. This is a total of 5 hours and also counts toward that patient day.
I need to test:
Each visit's begining time to make sure it is <= to End_interval
Each visit's ending time to make sure it is >= Start_Interval
If the visit was within the start end intervals total the whole time but if only part of it is within then count only those hours
Sum the hours found within the the interval
Thanks again