COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: RAJESH_COGNOS on 20 May 2009 01:50:33 PM

Title: How to Calculate difference between dates
Post by: RAJESH_COGNOS on 20 May 2009 01:50:33 PM
Hello,
I have a requirement to add a filter so that the report will generate results only for that last two months.There will not be any prompts but when I hit the report link it generates the results for last two months.
   In simple database terms it should calculate (CURRENT_TIMESTAMP - 2 MONTHS).
I tried to use the same (CURRENT_TIMESTAMP - 2 MONTHS) same but it generated an error message.
   What is the filter that I need to use to limit my results to last two months.
I am developing this on ORACLE.

Please help.
Thanks
Rajesh
Title: Re: How to Calculate difference between dates
Post by: josepherwin on 21 May 2009 01:28:06 AM
Hi Rajesh,

Date calculation can only be performed in Report Studio. There is a function called dateadd()

Or the sneaky way of doing it, just get the syntax of the underlying database and you can apply it against the data items.
Title: Re: How to Calculate difference between dates
Post by: ajaju on 21 May 2009 07:08:15 AM
Hi,

You can use the oracle add_months(sysdate,-2) function.
I hope this should work.

Aarti