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

NETWORKDAYS function in Available in Cognos?

Started by gatorfe, 03 Nov 2010 10:04:08 AM

Previous topic - Next topic

gatorfe

Hello.  Is there a function or way to tell the difference between two date fields in Cognos but just counting working days not Saturday or Sunday, just like the function in excel called NETWORKDAYS?  Thanks in advance for any comments!

phoenixfire

Hi,
I did this a few months ago. There is no straight forward function. Basically, you would have to write a code that goes something like this

Date Dif = Date 1 - Date 2
Use this Date Dif as the base value

If dayoftheweek for Date 1 equals 1, it means its a monday - day of the week is a function that can be used to find out the day of that particular date - 1 is monday, 2 is tuesday and so on.

So if Date 1 equals monday and
date dif < 5 (5 being the business days in the week)
then date dif becomes the number of business days between date 1 and date 2
date dif equals 5 or 6
then date dif is 4. ( since if monday is 1, then date dif 5 days brings it to saturday and 6 brings it to sunday)
date dif >= 7
calculate the value.

You have to do the above exercise for each day of the week...In the end you will end up with a monstrous code that only you will be able to understand.

There might be an easier method - but I searched everywhere and this was the best I could come up with.

Maybe someone else has a simpler solution 8)