COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: ajith on 28 Dec 2006 10:37:03 AM

Title: How to calculate YTD for Crosstab?
Post by: ajith on 28 Dec 2006 10:37:03 AM
Can anyone let me know how to calculate YTD data in a crosstab for a relational data source?
Title: Re: How to calculate YTD for Crosstab?
Post by: sir_jeroen on 28 Dec 2006 06:54:53 PM
is there more than one year in your date selection or is your date limited to the YTD timespan?
If there's more than one year you could use a case when  year(date) = 2006 then (value) else (0) end
Title: Re: How to calculate YTD for Crosstab?
Post by: ajith on 29 Dec 2006 10:24:14 AM
Oh! sorry I missed that information

Fiscal Year starts from April 1 and ends on March 31. The user has the ability to choose Month and Year at the prompt and he can choose any year from 1985 to 2020.
Suppose the user chooses Feb 2004 in the prompts then the report should display data from April 1, 2003 to Feb 29, 2004. Is it as easy as it sounds????

Thanks.
Title: Re: How to calculate YTD for Crosstab?
Post by: sir_jeroen on 02 Jan 2007 12:29:44 PM
so:
step 1. Convert the year and month to a valid date if possible
step 2 create a  date_from (e.g. ?year? -1 ) and  a date_to based on this created valid date
step 2: filter your data on " where date between date_from and date_to "
step3: just sum all data and now you have all data for a ytd.