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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Average closing time on formula

Status
Not open for further replies.

Crystalguru

Technical User
Oct 4, 2001
303
US
Hello,

I am in need of calculating an average closing time on this formula:
//time between open and close call

//begin formula
WhilePrintingRecords;

NumberVar TotalSec := datediff("s",{Help_Desk.Problem Request Date}, {Help_Desk.Close Date & Time}) ;

NumberVar Days := Truncate (TotalSec / 86400);
NumberVar Hours := Truncate (Remainder ( TotalSec,86400) / 3600);
NumberVar Minutes := Truncate (Remainder ( TotalSec,3600) / 60);
NumberVar Seconds := Remainder ( TotalSec , 60);

Totext ( Days, '00', 0,'') & 'day:'&
Totext ( Hours, '00', 0,'') & 'hr:'&
Totext ( Minutes,'00', 0,'') & 'min:'&
Totext ( Seconds,'00', 0,'') & "sec"

//end formula


ANy ideas?

thanks!
 
You can do this by using two formulas.
First, create the formula that returns your total seconds per call:

NumberVar TotSecForAvg:= datediff("s",{Help_Desk.Problem Request Date}, {Help_Desk.Close Date & Time}) ;

Do a "summary operation" of "Average" for your new field.

Then use the Average field for the conversion to text of the total seconds;

Numbervar AvgTime :=average ({the.newfield}, {group})
NumberVar Days := Truncate (AvgTime / 86400);
NumberVar Hours := Truncate (Remainder ( AvgTime,86400) / 3600);
NumberVar Minutes := Truncate (Remainder ( AvgTime,3600) / 60);
NumberVar Seconds := Remainder ( AvgTime , 60);

Totext ( Days, '00', 0,'') & 'day:'&
Totext ( Hours, '00', 0,'') & 'hr:'&
Totext ( Minutes,'00', 0,'') & 'min:'&
Totext ( Seconds,'00', 0,'') & "sec" Mike

Before: After
[morning] [bugeyed]
 
Hey Crystalguru,

Looks like you got a MagicTSD database there.

If you need any help, let me know. My company focuses on consulting and report writing for that application - so if you have any questions or run into any issues, just ask.

ro
Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
Mike, Thank you so much! My report is FINISHED. That is such a wonderful feeling. Your help was appreciated. Have a cup of coffee on me!

Rosemary- Yup, MagicTSD database is what I am working with. I will keep your info close to me! Thank you for letting me know about you.

[2thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top