COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: AnthonyJ on 02 Mar 2010 12:19:31 AM

Title: Display Last Year's Date
Post by: AnthonyJ on 02 Mar 2010 12:19:31 AM
I am trying to display last year's date based on the current date. I used a layout calculation and tried using the following syntax but getting a parsing error -

_add_years(current_date,-1)

_add_years(Today(),-1)


Any ideas ?

Title: Re: Display Last Year's Date
Post by: CognosPaul on 02 Mar 2010 01:28:52 AM
The _add_years function needs a timestamp, not a date which Today returns. Try this instead: _add_years(date2timestamp(Today()),-1)
Title: Re: Display Last Year's Date
Post by: AnthonyJ on 02 Mar 2010 01:27:19 PM
Thanks. That worked ! :)