cancel
Showing results for 
Search instead for 
Did you mean: 

Total Avg in Hours and Min

cothmer
Participant
0 Kudos

I have a report where I am getting the total minutes for a group of patients based on order date and transfer date using a formula called @TimeDiff: datediff("n",{Order_Proc.Order_Time},{Clarity_Adt.Effective_Time}), I then created another formula to sum up the minutes called @SumMin: sum({@TimeDiff}). I can get an AVG IN Minutes but I want an AVG in HOURS and MINUTES. So if I have 4 patients and the total minutes for these 4 patients is 255 minutes the avg in minutes is 63.75. How do I get that in Hours and Minutes ? Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Curt,

1. Modify the TimeDiff formula so it returns value in seconds:

datediff("s",{Order_Proc.Order_Time},{Clarity_Adt.Effective_Time})

2. Create a formula with this code to display the Avg in HH:MM:

Numbervar s := SUM({@TimeDiff})/DistinctCount({PatientNumber});
NumberVar Hours   := Truncate (s/3600);
NumberVar Minutes := Truncate (Remainder (s,3600)/60);
NumberVar Seconds := Remainder (s,60) ;
Totext (Hours,0,"") + ':'+ Totext (Minutes,0,"");

-Abhilash

Answers (0)