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

How to have date filter automatically account for weekends?

Started by sjdig, 28 Jun 2016 02:10:00 PM

Previous topic - Next topic

sjdig

Good afternoon, I am relatively new to COGNOS and have been struggling with finding a way to have a daily report automatically account for when it is a Monday and to look back to Friday for data. These reports always look back one business day for any data that needs to be caught. In addition, users in my organization also can perform tasks on Saturday that would need to be accounted for on Tuesday's report that looks at work performed on Monday (which covers Saturday through Monday).

Currently, I am running three reports (Monday Report on Monday, Tuesday Report on Tuesday, and Wednesday, Thursday, Friday report on those days) as it was the simplest solution I could find at the time I had built out the initial reports.

My filter for Monday is [Date] = _add_days(current_date, -3)
My filter for Tuesday is [Date] between _add_days(current_date, -3) and _add_days(current_date, -1)
My filter for Wednesday is [Date] = _add_days(current_date, -1)

Is there an easier way to automatically have this process occur in one report rather than generating three separate reports each time a daily report is built?

Also, would there be a way to factor in when Federal Holidays occur to account for the date range as well?

I'm guessing I'll need either a case or if statement but find myself struggling to put it together in a manner that works.

Thank you in advance for any help you can give,
sjdig

Edit: Also, I apologize if this has been asked before. I did attempt to use the search function prior to posting but had little luck with the results that I found.

BigChris

Your filter could be something like:

(_day_of_week(current_date,1) = 1 and [Date] = _add_days(current_date,-3)) or (_day_of_week(current_date,1) =2 and [Date] between _add_days(current_date, -3) and _add_days(current_date, -1)) or [Date] = _add_days(current_date,-1)

sjdig

Quote from: BigChris on 29 Jun 2016 01:58:01 AM
Your filter could be something like:

(_day_of_week(current_date,1) = 1 and [Date] = _add_days(current_date,-3)) or (_day_of_week(current_date,1) =2 and [Date] between _add_days(current_date, -3) and _add_days(current_date, -1)) or [Date] = _add_days(current_date,-1)

It looks as though this may just work! I will set it up on a few of my daily reports to make sure it performs correctly. Thank you so much for your help!

BigChris

You're welcome - if it doesn't work just post back and I'll take another look