2 Replies Latest reply on May 23, 2013 12:48 PM by jacksrmd

    Calculation for 5 Business Days - What's the best syntax/formula?

    jacksrmd

      Title

      Calculation for 5 Business Days - What's the best syntax/formula?

      Post

           Since my end users will need business days off of a date that 99% of the time will be a week day (business day), could I cheat and just create the following calc:

           NoticeDate + 7

           Considering that 5 business days for any weekday = 7 days???

           If not, any suggestions from anyone?

           I looked on the knowledgebase and I searched within the forum already.  Holidays are irrevelant for me.

           Thanks in advanced. 

        • 1. Re: Calculation for 5 Business Days - What's the best syntax/formula?
          philmodjunk

               And that would give you a result that is right 99% of the time. Is 99% correct acceptable to your users? What will you do for the 1% of the time that it's not correct?

               If that's an auto-enter calc and your users are OK with manually fixing the date on the rare times when it is wrong, then so far so good.

               If not, then you will need a calculation that is correct 100% of the time. There is a KB article that computes the number of weekdays between two dates, but what you need for that would be actually simpler, A case function can add a different number of days when the initial date falls on Sunday and yet another value when the date falls on Saturday.

               Let ( [ d = YourTable::Initialdate ;
                         dw = DayOrWeek ( d ) ];
                       Case ( dw = 1 ; d + 5 // d is on Sunday, compute date for next Friday
                                   dw = 7 ; d + 6 // d is on Saturday, compute date for next Friday
                                   d + 7 // all other days of week, add 7 to compute same day of week, next week
                                 )
                      )

          • 2. Re: Calculation for 5 Business Days - What's the best syntax/formula?
            jacksrmd

                  Thanks Phil  :)

                 You've assisted me so much within the last 6 months, I'm starting to kinda-sorta think like you  :)   But I have a lonnnnnnnnnnnnnng way to go.

                 I started working on the dow Case calc yesterday but didn't get a chance to finish before I left work.

                 When I wrote my example down on paper, it hit me like a bolt of lightning that M-F = next week's M-F   for adding 5 business days.

                 As always, Thanks Phil!!!