COGNOiSe.com - The IBM Cognos Community

Legacy Business Intelligence => COGNOS ReportNet => Topic started by: agorsky on 20 Oct 2005 06:05:38 PM

Title: [Solved] Display Last Month In Text Item
Post by: agorsky on 20 Oct 2005 06:05:38 PM
Hello--

I have been trying to figure out a problem regarding the Text Item object used as a report header (above the report & NOT in the header area).Ã,  I have created a Year to Date report.Ã,  I created 1 Text Item that says "January - ".Ã,  I created another Text Item that I want to display the name of the previous month.Ã, 

I have added a Data Item to the query that has the following expression: extract(month,_add_months(current_date,-1))Ã,  I have ensure that aggregation is turned off.Ã,  Within the Text Item I add the following code into the Expression Editor:

CASE [PreviousMonth]
WHEN 1 THEN 'January'
WHEN 2 THEN 'February'
WHEN 3 THEN 'March'
WHEN 4 THEN 'April'
WHEN 5 THEN 'May'
WHEN 6 THEN 'June'
WHEN 7 THEN 'July'
WHEN 8 THEN 'August'
WHEN 9 THEN 'September'
WHEN 10 THEN 'October'
WHEN 11 THEN 'November'
WHEN 12 THEN 'December'
END

NOTE:Ã,  We successfully did this on a List Report but this is a Crosstab and does not seem to work. I have literally copied what we have in the working List report to this Crosstab report.Ã,  However, the report fails to validate.Ã,  It states that the CASE statement is invalid.Ã,  The List report DOES validate properly.

Any ideas?Ã,  I am stumped!

Thanks!

Aaron

Title: Re: Display Last Month In Text Item
Post by: sir_jeroen on 21 Oct 2005 04:35:56 AM
You know that a crosstab can't handle text items in the facts area?
Title: Re: Display Last Month In Text Item
Post by: wink on 21 Oct 2005 01:29:36 PM
Hi,

But the question is... do you want to show these values as cells or on the rows / columns.... ? If cells it is gonna be hard.... on rows or columns it shouldn't be a problem...... So info needed to help you.

Regards, vincent
Title: Re: Display Last Month In Text Item
Post by: agorsky on 21 Oct 2005 03:32:53 PM
Hello... I am attaching a screenshot of the report layout.  Let me know if this helps clarify what I am trying to accomplish.
I appreciate the help!

Aaron
Title: Re: Display Last Month In Text Item
Post by: sir_jeroen on 21 Oct 2005 04:11:20 PM
For my ease: Can you create the list report based on GO Sales and post it... I will try to work this out to a  solution / tutorial...
Title: Re: Display Last Month In Text Item
Post by: agorsky on 21 Oct 2005 04:37:32 PM
Hi...

Attached are reports from GoSales in 2 formats: list and crosstab.  I can get the list format to work correctly.  However, the crosstab is proving to be a challenge.  I look forward to your solution!

Thanks,

Aaron
Title: Re: Display Last Month In Text Item
Post by: sir_jeroen on 21 Oct 2005 04:55:46 PM
Your solutions is on the way... It's gonna be a very short tutorial
Title: Re: Display Last Month In Text Item
Post by: sir_jeroen on 21 Oct 2005 05:15:22 PM
There's a new tutorial for this... Good luck and  please don't forget to Close / Solve this topic's status....
Title: Re: [Solved] Display Last Month In Text Item
Post by: sir_jeroen on 21 Oct 2005 06:17:25 PM
Btw...
You could also do with a Master/Detail report. In the master report you define your filters eg. Year/month/Product line

That would be even easier.