COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: src144 on 23 Apr 2021 02:04:29 PM

Title: Display Date Range in Header
Post by: src144 on 23 Apr 2021 02:04:29 PM
First, let me apologize in advance if the topic is posted on the wrong thread. I am using IBM Cognos Report Studio Version 10.2.2. I have a report that is pulling data from the last 7 days. I would like to add a header to reflect the date range. For instance, if I run the report on 4/23, the date range should be displayed on the header to reflect 04/15/2021-04/22/2021. How can this be accomplished?

I have inserted a text item in a block and selected the source type as a report expression. I then have _add_days (AsOfDate (), -7 ) in my expression definition but keep getting errors. Any help is GREATLY appreciated.
Title: Re: Display Date Range in Header
Post by: BigChris on 24 Apr 2021 11:58:03 AM
The simplest thing to do is probably to add a calculation in your query for
_add_days(current_date,-7)
and perhaps a second one for
_add_days(current_date,-1)
then you can bring them into your header as singletons, perhaps with text fields before and between, so that you get something along the lines of

'Dates between ' [Calculation 1] ' and ' [Calculation 2]