COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: chinnucognos on 12 Feb 2014 05:47:33 AM

Title: Date range display at report header
Post by: chinnucognos on 12 Feb 2014 05:47:33 AM
Hello everyone,
i have one requirement to display date range at header level.

The report has three columns ...
1product id,
2.product date,
3.product description.

suppose,
product id   product date   prod descr
ALMPR2       1/27/2014       VISA PREMIER
ALMGLD2     1/17/2014       VISA GOLD....

then at report header level, date range should display as January 1st,2014 to January 31st 2014 based on product dates


Thanks in advance
Title: Re: Date range display at report header
Post by: BigChris on 12 Feb 2014 05:57:42 AM
Hi,

What's the calculation that you want to do? Are you going to prompt / filter to just get the items that have a product date in January (in your example)?

C
Title: Re: Date range display at report header
Post by: chinnucognos on 12 Feb 2014 06:02:41 AM
Thanks for quick response... there is no promptsin report.
Those dates should come based on product dates column.
if prouduct dates are 1/16/2014,1/18/2014,1/9/2014...etc...
Date range should display  1/1/2014 to 1/31/2014 i.e Janary 1st,2014 to January 31st,2014
Title: Re: Date range display at report header
Post by: nblank on 12 Feb 2014 06:11:53 AM
That doesn't make sense. Then I would expect date range 1/9/2014 - 1/18/2014. The min and max of your product dates.

Or do you want the complete range for the month january?

Nanno
Title: Re: Date range display at report header
Post by: chinnucognos on 12 Feb 2014 06:14:50 AM
Business needs that mandatory date range...they think that proudcut dates are wihin January 1st,2014 to January 31st,2014 in above example data...
Title: Re: Date range display at report header
Post by: nblank on 12 Feb 2014 06:37:10 AM
In your existing query (in Report Studio) you can add an new data item. The expression: max([product date]), name it max_date. Another data item. The expression min([product date], name it min_date.

Add singleton in your header. With properties choose above mentioned query. Drag in [min_date]

Add another singleton in your header. With properties choose above mentioned query. Drag in [max_date]

Does that work for you?

Nanno
Title: Re: Date range display at report header
Post by: chinnucognos on 13 Feb 2014 03:21:28 AM
it didnt worked... :(
Title: Re: Date range display at report header
Post by: MFGF on 13 Feb 2014 04:58:42 AM
Quote from: chinnucognos on 13 Feb 2014 03:21:28 AM
it didnt worked... :(

???

That doesn't really tell us anything. Did it return an error? Did it return nothing? Did it return the wrong dates? Did it return the right dates in the wrong format?

The only solution I can suggest to "it didn't work" is

"fix it"

:)
Title: Re: Date range display at report header
Post by: chinnucognos on 13 Feb 2014 05:06:39 AM
it throwing error.....seems max and min functions doesnot match
Title: Re: Date range display at report header
Post by: MFGF on 13 Feb 2014 05:37:21 AM
Quote from: chinnucognos on 13 Feb 2014 05:06:39 AM
it throwing error.....seems max and min functions doesnot match

Wow! You seem intent on not giving us even the hint of a detail that might help! Saying "it is throwing error" is like saying "it doesn't work". What is the error? What syntax did you use? What steps did you take?

Really - how can you expect us to be able to help you when you don't seem inclined to give us any details on your problem? If I said to you "My car doesn't work - can you help?" how would you know what the issue is? If you replied and asked for details of the issue and I responded with "it has an error" would you be any more able to help? No? The same applies here.

Did you use the inbuilt Cognos summaries maximum() and minimum()? What exactly is the syntax you used in each expression? What error message is returned?

MF.
Title: Re: Date range display at report header
Post by: chinnucognos on 13 Feb 2014 06:06:41 AM
Iam really sorry for not giving proper reason, since iam working on multiple defects i have not concentratd to elaborate error.

Here is the exact error...
after using maximum and minimum... dates are showing as Jan 13th,2014 to Jan 28th,2014(these values are as per database)
but exact requirement is Jan 1st,2014 to Jan 31st,2014


Title: Re: Date range display at report header
Post by: MFGF on 13 Feb 2014 06:14:17 AM
Hi,

You need to use functions to get the first and last days of the month.

_first_of_month( minimum( [product date item] ) )

and

_last_of_month( maximum( [product date item] ) )

Cheers!

MF.
Title: Re: Date range display at report header
Post by: chinnucognos on 13 Feb 2014 06:53:54 AM
Now it worked fine MFGF....Really thanks a mil

Cheers.................... :)
Title: Re: Date range display at report header
Post by: nblank on 13 Feb 2014 08:52:19 AM
Thanks MFGF for the final solution. I'm used to the Oracle syntax (min & max).

Thanks chinnucognos for letting us know that it works.

Nanno