6 Replies Latest reply on Jun 10, 2014 10:56 AM by Xiaojun Wu

# Net Working Day Calculation

I am trying to calcultated net working day within a month. Any one could give me a suggestion?

Thanks

• ###### 1. Re: Net Working Day Calculation

Hi Xiaojun,

Here are some links that may help:

Don

• ###### 2. Re: Net Working Day Calculation

Hi Xiaojun,

Thanks,

Don

• ###### 3. Re: Net Working Day Calculation

I was able to get the fomular as below:

1. In Tableau Desktop, select Analysis > Create Calculated Field.
2. In the Calculated Field dialog box that opens, enter a name for the field.
3. In the formula field, type the following, and then click OK:
`DATEDIFF('week',[<Start Date>],[<End Date>])*5`

`+`

`MIN(DATEPART('weekday',[<End Date>]),6)`

`-`

`MIN(DATEPART('weekday',[<Start Date>]),6)`

Where <Start Date> and <End Date> are the names of date fields in the worksheet.

But it does not seem correct.

• ###### 4. Re: Net Working Day Calculation

Ok. Here's a great link, though it will take some work to put together. Dan Huff, the author of the example, put together the information you require to create your 'networkdays' formula.

• ###### 5. Re: Net Working Day Calculation

• ###### 6. Re: Net Working Day Calculation

Got the fomular below:

Got most of month's net working day correct except Feb 2013 and March 2013. If someone could take a look at the fomular below and see erro. Please let me know.

Thanks

If DATEPART('weekday',[First Day of the Month])=6

then

DATEDIFF('week',[First Day of the Month],[Last day of the month],'sunday')*5

+

MIN(DATEPART('weekday',[Last day of the month]),6)

-

MIN(DATEPART('weekday',[First Day of the Month]),6)

elseif DATEPART('weekday',[First Day of the Month])=7

then

DATEDIFF('week',[First Day of the Month],[Last day of the month],'sunday')*5

+

MIN(DATEPART('weekday',[Last day of the month]),6)

-

MIN(DATEPART('weekday',[First Day of the Month]),6)

Else

DATEDIFF('week',[First Day of the Month],[Last day of the month],'sunday')*5

+

MIN(DATEPART('weekday',[Last day of the month]),6)

-

MIN(DATEPART('weekday',[First Day of the Month]),6)

+

1

End