?
Solved

Crystal Reports need formula that will subtract weekends and holidays from a datediff formula

Posted on 2011-05-12
3
Medium Priority
?
989 Views
Last Modified: 2012-08-13
Need to track the number of days between the Date that a Work Order is requested and Completed. I have a formula that does this.

DateDiff("d",{WOHeader.RequestDate},{WOHeader.ComplDate})

I have a DaysDifference formula that someone on EE gave me for an aging report. I need to subtract the weekend days and holidays from the number that is returned with the formula above.

Can I adapt the formula that was provided for me for the aging report to this? I included the DaysDifference formula.

Thank you!
//@DaysDifference
Global DateVar Array Holidays;
Local NumberVar FullDays;
Local NumberVar BankHolidays;
Local NumberVar Weekends;
Local NumberVar i;
Local Datevar StartDate := {WOHeader.RequestDate};//put your date here;
Local DateVar EndDate := Today;

    (
    //Count the number of full days between dates
    Fulldays := DateDiff ('d',StartDate,EndDate);

    //Count any holidays between dates
    For i := 1 to Ubound(holidays)
    Do
        If Holidays[i] >= StartDate and Holidays[i] <= EndDate Then
            BankHolidays := BankHolidays + 1;

    //Count any weekends between dates
    Weekends := DateDiff("ww", StartDate, EndDate, crsaturday) + 
                DateDiff("ww", StartDate, EndDate, crsunday)
    );

//Calculate Working days
FullDays - Weekends - BankHolidays

Open in new window

0
Comment
Question by:J C
  • 2
3 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 35749932
That formula already subtracts out the holidays and weekends.

Just use the Complete Date field instead of TODAY in the formula.

mlmcc
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 35749939
You will need to create a new version of the formula with the changed field.

mlmcc
0
 

Author Comment

by:J C
ID: 35750151
Thanks a lot!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Hi, I am very much excited today since I'm going to share something very exciting Tool used for Analytical Reporting and that's nothing but MICROSTRATEGY. Actually there are lot of other tools available in the market for Reporting Such as Co…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Screencast - Getting to Know the Pipeline
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question