Page 1 of 1

number of working days in a week

Posted: Wed Feb 24, 2010 12:28 pm
by vikramkola
please help me in finding number of working days in a week syntax.

thanks in advance.

Posted: Wed Feb 24, 2010 12:32 pm
by chulett
Short answer is 5. :wink:

I'm assuming you mean the number of working days between two dates. Regardless, you would need to define a 'working day' for us. Does it include company holidays? If so, you'll need some kind of 'date dimension' like lookup, be it a warehouse table or spreasheet dumped to a csv.

Posted: Wed Feb 24, 2010 12:50 pm
by chulett
If it doesn't, i.e. you just need to skip Sat & Sun, then you could write something to loop from one date to the next and not count them. A lookup would be best, however, as you may be able to get the number of 'working days' a week or a month at a time.

Posted: Wed Feb 24, 2010 12:58 pm
by vikramkola
chulett wrote:Define a 'working day' for us. Does it include company holidays? If so, you'll need some kind of 'date dimension' like lookup, be it a warehouse table or spreasheet dumped to a csv. ...


for example:02/15/2010 to 02/21/2010 are week days
02/17/2010 is holiday
02/20/2010 and 02/21/2010 are saturday and sunday

write a syntax in finding number of working days in this week.
data we are getting from a sequential file ,csv file.

I should get answer as 4.

give the trasformation functions syntax or what ever way as you can do please explain.
imagine how ever you like and please type the syntax, immediatly needed.

Posted: Wed Feb 24, 2010 3:50 pm
by ray.wurlod
Well, it's now four hours later, so I guess you don't need it now, since it was "immediately needed".

DSXchange is an all-volunteer site whose members post as and when (and if) they can, but at all times are under no obligation to do so. If you need immediate assistance sign up with your official support provider for super-priority service ("priority" typically only gets you four hour response time). Learn just how valuable "urgent" is.

You have been given a complete answer by previous posters.

If you choose not to implement it yourself, then that falls into the category of consulting (with concomitant payment).

Posted: Wed Feb 24, 2010 7:05 pm
by chulett
Sorry, I had an immediate need to go for a job interview, so that took precedence. :?

And people can't decide on a solution for you, it needs to be something your company can support. For example, how will you know that "02/17/2010" is a holiday? Someone can lay out a solution that leverages a date dimension but that's no good if you don't have (or are not willing to build / support) one.

And as one last "ps" - you can tell what day is what by converting it to its "day of the week" number, which typically run from 1 to 7 or sometimes 0 to 6. And what day actually starts any given week (Sunday or Monday) is typically a configuration parameter.