COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: CKdoubleU on 21 Jan 2016 04:33:07 PM

Title: Automatic date changes in report header
Post by: CKdoubleU on 21 Jan 2016 04:33:07 PM
I have a report that looks at cumulative data over the period of the previous 15 months from whenever the report is run (e.g. report run today will compile 10/2014 thru 12/2015, report run next month will compile 11/2014 thru 01-2016, etc.). I use the following expression:

[Work Entry Month] between _first_of_month(_add_months(current_date,-15)) and
_last_of_month(_add_months(current_date,-1))

I'm trying to create a header in the report page that will summarize the information with a title:
"Data valid from (whatever the beginning month is at the time the report was run) through (whatever the ending month is, etc., etc.)."

I'm sure this is right in front of my nose, but I can't see it. Any help is greatly appreciated.
Thanks,
Chris
Title: Re: Automatic date changes in report header
Post by: BigChris on 22 Jan 2016 01:55:59 AM
Don't try to do it all in one field. Bring in a text field with 'Data valid from ' then bring in a layout calculation for the start date, then another text field for ' through ' and finally another layout calculation for your end date.
Title: Re: Automatic date changes in report header
Post by: CKdoubleU on 03 Feb 2016 11:10:56 AM
Thanks for the reply; I'm actually structuring the block exactly as you're describing.

My goal is to have a block which contains a text field with "Data between" followed by a layout calculation, then another text field with "through" and another layout calculation.

Unfortunately it's writing the layout calculations that I'm having difficulty with, and which I'm looking for assistance.
Title: Re: Automatic date changes in report header
Post by: BigChris on 04 Feb 2016 02:08:48 AM
Ahhh ok...sorry, I didn't pick up on that before. Based on your filter, don't they just need to be

_first_of_month(_add_months(current_date,-15))

and

_last_of_month(_add_months(current_date,-1))
Title: Re: Automatic date changes in report header
Post by: CKdoubleU on 04 Feb 2016 10:09:05 AM
YES... that did it!! Man, I can't believe I've spent as much time on this as I did.

Like I said, I figured it was right in front of my nose. It's like I completely forgot what 2+2 equals.

Angry, frustrated, embarrassed...


Anyway, thank you; I really appreciate it!
Title: Re: Automatic date changes in report header
Post by: BigChris on 04 Feb 2016 10:26:43 AM
No need to be embarrassed...we've all been there! Glad I was able to help. :)