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

Summarizing Previous(fld) fields

Status
Not open for further replies.

Stupot2k

Vendor
Oct 5, 2001
19
0
0
GB
I am trying to calclate an MTBF figure for a number of reported incidents. I am using the Previous(fld)Function to calclate the time elapsed between subsequent records:

( {@actual_clear_datetime}- Previous ({@actual_reported_datetime})) * 24

When I try to summarize the field to work out an average I am ot able to do so. Can anybody help to identify another way of achieving this?

Sample Data:
Reported Cleared Priority Ticket MTBSI MTBF
29/03/2007 25/06/2007 A 0000156634
11/05/2007 13/06/2007 A 0000161175 1,034.45 1,821.52
22/05/2007 21/06/2007 A 0000162283 265.84 979.89
04/06/2007 04/06/2007 B 0000163479 307.44 312.67
04/06/2007 04/06/2007 A 0000163483 0.03 0.78
04/06/2007 05/06/2007 B 0000163523 3.17 27.17
05/06/2007 05/06/2007 B 0000163649 22.13 23.45
11/06/2007 11/06/2007 B 0000164256 140.27 141.12


Many thanks

Stuart
 
I cannot tell from your data sample which field represents the change from the previous record, but a running total field or variables should do the trick.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"If you have a big enough dictionary, just about everything is a word"
--Dave Barry
 
You could use a variable like:

//{@accum} to be placed in the detail section:
whileprintingrecords;
numbervar summtbf := summtbf + {@MBTF};
numbervar cnt;

//{@displ} to be placed in the report footer:
whileprintingrecords;
numbervar summtbf;
numbervar cnt;
if cnt > 0 then
summtbf/0

If you want the average at a group level, you would also need a reset in the group header:

whileprintingrecords;
numbervar summtbf;
numbervar cnt;
if not inrepeatedgroupheader then(
summtbf := 0;
cnt := 0
);

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top