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

Average age of a job ticket

Status
Not open for further replies.

TudorSmith

Programmer
Jan 14, 2002
245
GB
I nee to calculate the average age of a job ticket, based on a ticket.open.time and a ticket.close.time

I currently have the following formula:

Code:
DateVar OpenDate := Date({Probsummarym1.open.time});

if isNull({probsummarym1.close.time})  then
   DateVar CloseDate := currentdate
else
   DateVar CloseDate := Date({Probsummarym1.close.time});

TimeVar OpenTime := Time({Probsummarym1.open.time});

if isNull({probsummarym1.close.time}) then
   TimeVar CloseTime := currenttime
else
   TimeVar CloseTime := Time({Probsummarym1.close.time});

NumberVar Dys := CloseDate - OpenDate;
NumberVar Secs  :=  CloseTime - OpenTime;

((Dys * 86400) + Secs) / 86400

Now this formula (plucked from a template report) displays the average "Days" a ticket is open, but how would I make it so I get the average hours:minutes a ticket is open?

Many thanks

birklea birklea ~©¿©~ <><
I know what I know...don't presume that I know what I don't! Smithism!!!
 
I've done some of this in the past..

I took the open datetime and closed datetime and did a

DTDiffToSeconds(open_datetime,closed_datetime) to get the total time in seconds that the problem open.

Sum it up and divided bt the number of problems, which will give you the average age of your problems in seconds

You can convert the seconds back to standard time.

Here's an example :
(Sum ({PROBLEMS.TIME_SPENT}) / Count {PROBLEMS.PROBLEM_ID}))

Hope this helps. Brian
 
I'm working with Crystal 8.5 and have a problem of creating a formula which would calculate an average time distance between list of dates. The problem is that the list consists just values of dates not any particular order. For example:

Product Date
a 12-Feb-02
a 1-Apr-02
b 31-Dec-02
c 31-Jan-03
c 28-Feb-03
b 1-Mar-03
a 1-Mar-03


So for example I would have to calculate for product a the average difference between dates 12-Feb-02 to 1-Apr-02 and 1-Apr-02 to 1-Mar-03.

Any help?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top