The median (not average) date between January 1 and January 3 is January 2.
The mean date would be an arithmetic average and the mode date, the one that occurs most often.
2007/01/01 - 2 occurrence of date 2007/01/05 - 6 " 2007/01/06 - 8 " 2007/01/07 - 13 "
For this data, very roughly speaking, the median date would be the 2007/01/04, a date where nothing occurred. The Mean date would be 2007/01/06 and the mode date would be 2007/01/07. This is where you get the lies, damn lies and statistics from.This message has been edited. Last edited by: Alan B,
Alan. WF 7.705/8.007
August 14, 2007, 03:46 AM
FrankDutch
yes...
I thought DATE was a typo and he ment DATA....
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
August 14, 2007, 03:00 PM
gweller
Sorry, I will be more specific...
I have a table where we store document information by document type. I need a report that will tell me the average date received of the oldest 5 documents for each doc type
WebFOCUS 8201M/Windows Platform
August 14, 2007, 03:55 PM
Darin Lee
just have a sec so I don't have code, but your best bet would be to use date subtraction from a base date for each of the five days, calculate an average of those days elapsed, then add that number back to the base date. This should give you and "Average Date."
Regards,
Darin
In FOCUS since 1991 WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex WF Client: 77 on Linux w/Tomcat
August 14, 2007, 04:15 PM
FrankDutch
Convert the date to a number (like excel does) calculate the average of these numbers and convert the integer of the result back to a date (use the integer to prevent a date and time result)
To find the oldest five is an other challenge...
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
August 14, 2007, 04:26 PM
mgrackin
gweller,
It sounds like you still need to decide which average you want:
MEAN, MEDIAN, MODE or MIDRANGE?
Here's a web site that discusses the difference of the first three:
... and rather than converting the date to a number, just use the WebFOCUS internal date format (i.e. YYMD or DMYY) as it is an offset from the base date and is, essentially, a number anyway ...
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
August 15, 2007, 05:09 AM
Alan B
This sounds, to me, like an average age. Then just putting a date onto that age.
As an approach I would, rightly or wrongly, use something like:
DEFINE FILE VIDEOTRK
NEW_DATE/YYMD=TRANSDATE;
NOW_DATE/YYMD='&DATEYYMD';
DAYSOUT/I5= DATEDIF(NEW_DATE,NOW_DATE, 'D');
END
TABLE FILE VIDEOTRK
SUM MIN.NEW_DATE MAX.NEW_DATE MIN.DAYSOUT MAX.DAYSOUT AVE.DAYSOUT
COMPUTE DAYSBACK/I5=(AVE.DAYSOUT)*(-1);
COMPUTE AVE_DATE/YYMD=DATEADD(NOW_DATE, 'D',DAYSBACK);
BY PRODCODE
BY TOTAL LOWEST 5 TRANSDATE
END
I've left all the unnecessary fields in for testing.
Alan. WF 7.705/8.007
August 17, 2007, 03:24 PM
gweller
Thanks to everyone for their input it Alan's solution worked...