COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: rajeurokz on 01 Sep 2015 07:23:00 AM

Title: Calculating YTD, CTD and RYTD
Post by: rajeurokz on 01 Sep 2015 07:23:00 AM
Hi Team,

I want to implement the below logics in a prompt.
This will be cascaded using conditional block, but please help me in acheving the below requirements.

1.Year to Date (YTD)
2. Calender Year to Date (CTD): Current Date - 365 days
3. Rolling Year to Date: this would be prior month end date - prior month end date (less one year)
Title: Re: Calculating YTD, CTD and RYTD
Post by: MFGF on 01 Sep 2015 08:26:41 AM
Quote from: rajeurokz on 01 Sep 2015 07:23:00 AM
Hi Team,

I want to implement the below logics in a prompt.
This will be cascaded using conditional block, but please help me in acheving the below requirements.

1.Year to Date (YTD)
2. Calender Year to Date (CTD): Current Date - 365 days
3. Rolling Year to Date: this would be prior month end date - prior month end date (less one year)

Are you using a dimensional package or a relational package? The solution is different for each.

MF.
Title: Re: Calculating YTD, CTD and RYTD
Post by: rajeurokz on 02 Sep 2015 06:46:18 AM
Thanks for the reply, I'm using a relational package.
Title: Re: Calculating YTD, CTD and RYTD
Post by: rajeurokz on 09 Sep 2015 06:36:10 AM
Any update on this query ????
Title: Re: Calculating YTD, CTD and RYTD
Post by: MFGF on 09 Sep 2015 10:41:03 AM
Quote from: rajeurokz on 01 Sep 2015 07:23:00 AM
Hi Team,

I want to implement the below logics in a prompt.
This will be cascaded using conditional block, but please help me in acheving the below requirements.

1.Year to Date (YTD)
2. Calender Year to Date (CTD): Current Date - 365 days
3. Rolling Year to Date: this would be prior month end date - prior month end date (less one year)

Seems to me that YTD would be

[your date item] between _make_timestamp(extract(year, current_date),1,1) and current_date

CTD would be

[your date item] between _add_years (current_date,-1) and current_date

RYTD would be

[your date item] between _add_years(_last_of_month(_add_months(current_date,-1)),-1) and _last_of_month(_add_months(current_date,-1))

Cheers!

MF.
Title: Re: Calculating YTD, CTD and RYTD
Post by: rajeurokz on 10 Sep 2015 03:39:08 AM
This should fit my requirement, i'll try and enhance this further.


Thanks !!