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

Average of quickest 80% of cycle times 1

Status
Not open for further replies.

Tupence

MIS
Aug 31, 2005
16
FR
I have a formula cycle time which calculates the number of days between order placement and order closing. I am now trying to calculate of the quickest 80% what is the average number of days.

Can you help?
 
Have you been able to calculate the 'Average Number of Days'? You might then be able to use 'Top N'.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
thanks but i need to

1 sort the number of days formula ascending
2 count number of records
3 work out 80% of them
4 then average the 80%

TopN doesn't work for this.

I have tried using a formula in section expert to suppress records after 80% of the total number
recordnumber > count ({@cycle days) then average ({@cycle}}, {@Country))which is fine but means that i have to run for each country individually as recordnumber does not reset on change of group {@country}.
 
What is the content of your formula for cycle days? You can use a running total instead of recordnumber. Set it up to count the field you are grouping on, evaluate for each record, reset on change of group.

-LB
 
the cycle formula is purely

closed date - placed date to give number of days.

I don't realy understand how a running total will help me calculate the average top 80% though?
 
Use variables to accomplish this. Create these formulas:

//{@reset} to be placed in the country group header:
whileprintingrecords;
numbervar cnt;
numbervar sumdaydiff;
if not inrepeatedgroupheader then (
cnt := 0;
sumdaydiff := 0
);

//{@accum} to be placed in the detail section:
whileprintingrecords;
numbervar cnt;
numbervar sumdaydiff;
if cnt <= .8 * count({table.country},{table.country}) then (
cnt := cnt + 1;
sumdaydiff := sumdaydiff + {@yourdatediff}
);

//{@displave} to be placed in the country group footer:
whileprintingrecords;
numbervar cnt;
numbervar sumdaydiff;
if cnt > 0 then
sumdaydiff/cnt

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top