5 Replies Latest reply on Jul 25, 2013 9:14 AM by philmodjunk

# Number of Days less weekend days

### Title

Number of Days less weekend days

### Post

I have a database that I am adding to.  One of the results my boss would like to see is how long it takes for some specific work to be done.

So I have a date when we can start the work and a date when the work was completed.  Is there a calculation that I can use to get the number of days it took to complete the work without counting weekend days?

• ###### 1. Re: Number of Days less weekend days

There are other, more sophisticated approaches where you set up and maintain a "calendar" of the days you are open for business and then you can count the number of "open" days between two dates via this calendar. That approach can make it easier to allow for week days where you were closed due to a holiday or unforseen event.

• ###### 2. Re: Number of Days less weekend days

No this solution won't work because it is when you want to calculate a finish date.  I actually want to calculate how long the project took, excluding weekends

• ###### 3. Re: Number of Days less weekend days

Do you also need to exclude other days when you were closed in addition to week ends?

• ###### 4. Re: Number of Days less weekend days

Yes I do

• ###### 5. Re: Number of Days less weekend days

Then you will need a table that records each additional day that you are closed so that they can be deducted from the calculation's total days.

Use this relationship:

YourTable------<DaysClosed

YourTable::Date1 < DaysClosed::Date AND
YourTable::Date2 > DaysClosed::Date

For an explanation of the notation that I am using, see the first post of: Common Forum Relationship and Field Notations Explained

To Compute Elapsed Days

Let ( [ D1 = Date1 +  ( DayOfWeek ( Date1 ) = 7 )  ;
D2 = Date2 - ( DayOfWeek ( Date2 ) = 7 )
] ;
D2 - D1 - Div ( D2 - D1 ; 7 ) * 2 - Count ( DaysClosed::Date )
)
I tested this in the DataViewer by trying out a number of different dates and it appears to return the correct results.