COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: ShadowOfTheRiver on 26 Jul 2013 02:48:06 AM

Title: prior date to YTD
Post by: ShadowOfTheRiver on 26 Jul 2013 02:48:06 AM
Hi,

I' m trying to calculate ytd and the prior date to it using a selceted month as start month.

- start month:
prevmember([COPA_CD_article].[year_quarter_month].[year_quarter_month].[month] -> ?Start Month?)

- Previous month :
periodsToDate ([COPA_CD_article].[year_quarter_month].[year_quarter_month].[year (all)];[Start Month])

To show later months then start month:
except  ([ Months_of_the_prompts_year];[Previous Month])

Due to the complexed time structure we have :year_quarter_month I have to create tow further prompts:
- Selection_Year:  parent (parent ([Start Month]))
- Months_of_the_prompts_year:  descendants ([Selection_Year];2)

This works fine for the selected year but how to do to get the prior period?

Thanks in advance!
Title: Re: prior date to YTD
Post by: CognosPaul on 26 Jul 2013 03:25:53 PM
You're trying to get the prior year to date?

To find the YTD for the previous year, you just need to use parallelPeriod on the start month to go back a year:

periodsToDate([COPA_CD_article].[year_quarter_month].[year_quarter_month].[year (all)]; parallelPeriod([Selection_Year];-1;[start month]))

Title: Re: prior date to YTD
Post by: ShadowOfTheRiver on 29 Jul 2013 07:39:38 AM
thanks for the feedback,

It still doesnt work. It comes up with "LEVEL" error!!??
Title: Re: prior date to YTD
Post by: CognosPaul on 29 Jul 2013 10:40:57 AM
Whoops. Try:

periodsToDate([COPA_CD_article].[year_quarter_month].[year_quarter_month].[year (all)]; parallelPeriod([COPA_CD_article].[year_quarter_month].[year_quarter_month].[year (all)];-1;[start month]))