Use Networkdays function in Crystal Reports

Hi.  I have created a calculated field in crystal reports and need to add -2 workdays to it.  Not really sure how to do this in crystal.

calc field is "*EMD2:" +  totext({VMI_WC_PRIO_POS.EARLIEST_DATE}, "MM/dd/yy")  

I tried "*EMD2:" +  totext({VMI_WC_PRIO_POS.EARLIEST_DATE}-2, "MM/dd/yy") but I get weekend dates in some cases. Is there a way to do this?

thanks
LVL 7
valmaticAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
Yes.  You will have to test for the day of the week.

If the date is Monday or Tuesday you want the previous Friday?

Will the date ever be a Saturday or Sunday?

Try this

"*EMD2:" + ToText(
If DayofWeek({VMI_WC_PRIO_POS.EARLIEST_DATE}) = 2 then
    {VMI_WC_PRIO_POS.EARLIEST_DATE} - 3
Else if  DayofWeek({VMI_WC_PRIO_POS.EARLIEST_DATE}) = 3 then
    {VMI_WC_PRIO_POS.EARLIEST_DATE} - 4
Else
    {VMI_WC_PRIO_POS.EARLIEST_DATE} - 2;)

Open in new window


mlmcc

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
valmaticAuthor Commented:
HI Mike,  I changed day 2 to -4 to get 2 workdays but perfect answer.  The extra knowledge is hugely appreciated ..
~V~
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.