COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: katdbc on 26 Aug 2011 12:59:30 AM

Title: reg: date filter
Post by: katdbc on 26 Aug 2011 12:59:30 AM
Hello ppl,

i have current year data prorarated to todays date and i would like to compare the similar data to the pevious year.
so the user inputs usinga parameter in yyyy-mm format
for eg?: 2011-08

so i should get data uptodate  for this year and ytd ,the august 26(today) th 2010. how should i write the filter for the previous year.

database used: DB2
from user: ?Parameter1?---> 2011-08

my filter:[Business View].[Previous year PMR Fact YTD (New ETL)].[REPORT_DATE] between date(substring(?Parameter1?,1,4)+'-01-01') - 1 year and date(?Parameter1? +'-01') - 1 year + 1 month - 1 day - (_days_to_end_of_month (current_date)) days.

this doesnt seem to be working and giving errors.

basically i need a query to find ytd value for the previous year that the user enters.
if user enters 2010-06,

i need a filter to get ytd values for 2009 .
Title: Re: reg: date filter
Post by: a.chamkeri on 30 Aug 2011 05:34:00 AM
Hi,

What you can do here is create 2 queries.
Query 1: filter for the date entered (eg: 2010
Query 2: filter for the date entered -1 eg. 2010-1 = 2009
Create a union of these queries. Design your report on this query.

Best of luck.