COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: jasp on 08 Apr 2011 09:15:28 AM

Title: Display System Date -1 , need to show Month and year
Post by: jasp on 08 Apr 2011 09:15:28 AM
Hi All,

Some users have created some crosstab reports using current month from a time dimension this is a member, which automatically changes every month.

however when they run the report  "Current Month" is displayed  as text in the report and they would like to see for Example Apr 2010, and not the text "Current Month".

I know i have to select the cell and change the source type  to Report Expression and use one of the functions. ie

string2date('2011-04-08') but this is not the current month as current month is the calendar month -1 .

Any suggestions on how to do this , also i would like it to be MM - YYYY being displayed.

thanks
Title: Re: Display System Date -1 , need to show Month and year
Post by: kattaviz on 08 Apr 2011 09:29:37 AM
Hi,

Try using the _add_months(current_date,-1) and format this expression as per your requirements.

HTH
Title: Re: Display System Date -1 , need to show Month and year
Post by: jasp on 08 Apr 2011 09:38:51 AM
hi katavitz

i tried that and i get

A parsing error was found at or near the position 24 in the expression "_add_months(current_date,-1) ".
Title: Re: Display System Date -1 , need to show Month and year
Post by: kattaviz on 08 Apr 2011 10:15:55 AM
Hi,

Create a query and in that query create a data item with the expression "_add_months(current_date,-1)". Then use this as singleton in your report to display the Current Month (Current Month-1 in your case). This did not gave me any errors.

What version of Cognos are you using and what is the DB?

HTH
Title: Re: Display System Date -1 , need to show Month and year
Post by: jasp on 08 Apr 2011 10:21:48 AM
i used your syntax , and instead of the report expression i used data item value and referenced it to the new data item, however on a simple report it works quite quickly on  the user reports it just hangs.

Use Cognos 8.3 and its DMR.

Thanks for your help.
Title: Re: Display System Date -1 , need to show Month and year
Post by: jasp on 08 Apr 2011 12:52:37 PM
I used the below, it works, thanks for your help, much appreciated.

_add_months(date2timestamp(Today()),-1)