[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: [sqr-users] Calculating Business Days



I've done it in VB, however you should be able to take the concept and use 
it in SQR.

You will first need a table of Holidays.

Then you need to count the number of holidays that fall between the 2 
dates in question.  You have a few options, I loaded them into an array 
and compared the dates.  You could also easily just use a count(*) where 
the dates fall between your target dates.

Then you can calculate business days as

        CVB_BUSD_NumOfBusinessDays = DateDiff("d", pdtBeginDate, 
pdtEndDate) - (DateDiff("ww", pdtBeginDate, pdtEndDate) * 2) - 
liNumOfHolidays

The code above is VB, just convert it to an SQR statement.  The big 
concept you need is to subtract out the weekends which is simply the 
number of weeks times 2. 

Rick Spoth





"Bryson, Steven" <Steve.Bryson@phh.com>
Sent by: sqr-users-bounces+spoth.richard=healthnow.org@sqrug.org
04/05/2004 03:51 PM
Please respond to "This list is for discussion about the SQR database 
reporting       language from Hyperion Solutions."

 
        To:     "'sqr-users@sqrug.org'" <sqr-users@sqrug.org>
        cc: 
        Subject:        [sqr-users] Calculating Business Days


Has anyone ever calculated this with datediff and subtracted holidays? 
Just
throwing the question out there. 


"The sender believes that this E-mail and any attachments were free of any
harmful and malicious code or defects when sent.  This message and its
attachments could have been infected during transmission.  By reading the
message and opening any attachments, the recipient accepts full
responsibility for taking protective and remedial action regarding the 
code
or such defects.  The sender is not liable for any loss or damage arising 
in
any way from this message or its attachments."

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users




_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users