COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: Lmsloman on 15 Jul 2010 01:40:17 PM

Title: Expression for "within 3 months"
Post by: Lmsloman on 15 Jul 2010 01:40:17 PM
Good Afternoon Folks,

This is my first (of hopefully many) posts within this forum. I am an extremely new BI/Cognos user, so I've kind of been picking up bits and pieces as I go along.....so (in advance) forgive my ignorance :)

I have been asked to create a report that will analyze procedures that have happened within a 3 month range (either before or after) of the date of that procedure.

For example:

I need to determine how many people had repeat procedures within a 3 month period/range (either before or after the date of service). My data item is titled " [Charge Date of Service] "

Can anyone assist?

Thank you in advance,

Laura
Title: Re: Expression for "within 3 months"
Post by: blom0344 on 16 Jul 2010 03:01:12 AM
Hi Laura,

Welcome to the forum..

Try the following:

1. Allow user to select a date from a calender prompt
2. Say the parameter to the prompt will be named 'dateselected'
3. Cognos allows a whole set of functions to work with dates;  _add_months  will allow for adding 3 or -3 months against a date / the parameter like:

[somedate] between (_add_months(?dateselected?,-3)) and (_add_months(?dateselected?,3))

This can be used to filter the data.

If you need to work with whole months, consider using _first_of_month  / _last_of_month functions