Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
Average Date
 Login/Join
 
Platinum Member
posted
Is there an easy way to calculate the Average date?


WebFOCUS 8201M/Windows Platform
 
Posts: 109 | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
yes

TABLE FILE CAR
SUM AVE.SALES
BY COUNTRY
END




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

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Expert
posted Hide Post
Please, it's a date calculation request!!!!

The average date between January 1 and January 3 is January 2.

select
to_date(date1, 'yyyy/mm/dd')
+ ((to_date(date2, 'yyyy/mm/dd')
- to_date(date1, 'yyyy/mm/dd')) / 2 )
from dual;

This will calculate the elapsed time between date1 and date2.

In this example, we used an ORACLE dummy table called DUAL.

We'll let Frank convert the above to WebFOCUS....


EDIT: TYPO

This message has been edited. Last edited by: Tom Flynn,


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Virtuoso
posted Hide Post
gweller

What do you want to infer from 'average date'?

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
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Virtuoso
posted Hide Post
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

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Platinum Member
posted Hide Post
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
 
Posts: 109 | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
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
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Virtuoso
posted Hide Post
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

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Virtuoso
posted Hide Post
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:

http://math.about.com/library/weekly/aa020502a.htm


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
 
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003Report This Post
Virtuoso
posted Hide Post
Here are some basic definitions. All of these are referred to as the Average.

Mean is obtained by summing all elements of the data set
and dividing by the number of elements.

Mode is the data element which occurs most frequently.

Median is the middle element when the data set is arranged in order of magnitude.

Midrange is the arithmetic mean of the highest and lowest data elements.

Got these from:

http://www.andrews.edu/~calkins/math/webtexts/stat03.htm


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
 
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003Report This Post
Expert
posted Hide Post
... 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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Virtuoso
posted Hide Post
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
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Platinum Member
posted Hide Post
Thanks to everyone for their input it Alan's solution worked...


WebFOCUS 8201M/Windows Platform
 
Posts: 109 | Registered: October 31, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders