If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Calculate Days between 2 dates not including Holidays?

Started by cjsasaki, 09 Dec 2015 11:22:32 AM

Previous topic - Next topic

cjsasaki

Hi
How can I calculate the days between 2 dates not including Holidays? (I have calculated the labor days but they include holidays).

I have a table like this :

RQ   - Start_Date              -End_Date
A     - 01/01/2015             01/01/2016
B     - 08/07/2015              01/01/2016

And another query with holidays:

ID Date
1 - 25/12/2015
2-  01/01/2016
.
.
.





bdbits

The best way is to add an attribute to your date dimension table (you do have one, right?) that indicates if it is a holiday.

But if you cannot do that, left outer join the two tables based on date, and only include those that have a null for the holiday side of the join.

cjsasaki

Hi bdbits

My table :
ID - Date
1     24/12/2015
2    01/01/2016
etc

It is for holidays. So there are only the holidays. Should I add all the days?

But then on my 2nd table I have

RQ   - Start_Date              -End_Date
A     - 01/01/2015             01/01/2016
B     - 08/07/2015              01/01/2016


And I want to calculate the holidays between start_date and end_date on each row.Like this :

RQ   - Start_Date              -End_Date           Holidays
A     - 01/01/2015             01/01/2016         1
B     - 08/07/2015              01/01/2016        2

Can this be possible?

Lynn


bdbits

Good one Lynn. I never remember to search the forum for past discussions.  :o

The way the guy did it (last post) is pretty much what I had in mind when I lightly tossed out the suggestion to add it to the date table.