Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with finding the average time

Status
Not open for further replies.

newbie0423

IS-IT--Management
Oct 29, 2012
103
US
I would like for someone to help me with getting the average time of numbers. I am calculating the turnover time from patient out of the room to the next patient in the room. My formula for that is @timediff:
if OnfirstRecord then
0
Else if Date({v_basic_case_rec_data.cr_prdate}) <> Date(Previous({v_basic_case_rec_data.cr_prdate}))then
0
Else if {v_basic_case_rec_data.room_mnc} <> Previous({v_basic_case_rec_data.room_mnc}) then
0
Else
if {v_basic_case_rec_data.surg_descr} <> previous({v_basic_case_rec_data.surg_descr}) then
0
else

IF {v_basic_case_rec_data.room_mnc} = PREVIOUS ({v_basic_case_rec_data.room_mnc})
THEN ({@start} - PREVIOUS ({@end}))/60;
When I put this formula on my report, I can't seem to do an average of the minutes. I want to total the minutes and then do an average. I'm using Crystal XI
 
There's a command called DateDiff, which includes an option to find the difference in minutes. (Also hours, seconds etc.) Try it, get familiar with it.

For getting the average, you can't use Crystal's own averaging options if the data has come from more than one detail line, as yours has, with the use of PREVIOUS. You may have to define your own variables, accumulate both the total differences in minutes and the number of lines.

I'm also wondering if it's correct to include zeros.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top