COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: leahmarie on 03 Oct 2011 11:17:02 AM

Title: Calculating YTD with Relational data
Post by: leahmarie on 03 Oct 2011 11:17:02 AM
Hey guys,

I have taken a stab at this, but I seem to be stuck.  My problem is that I hate using relational packages but anyway -  I am trying to calculate YTD amount based on a prompted period which has YYYY-MM, but the data type isn't date/time it is characterlength 16; so none of the date functions are working.  I even tried starting with just pulling Prior Period(month) but no luck there.  I've used extract, add_months, <=?month? to get months in the year by trying to extract the year, and also _round(?month?/100, 0) and none of it is working. 

I would try to use another item that has data type date/time, but this one is required.

Any suggestions would be greatly greatly appreciated!!! ;D

Thanks!!

Title: Re: Calculating YTD with Relational data
Post by: MFGF on 07 Oct 2011 04:36:43 AM
Hi,

You might find it more straightforward to convert the item to a date datatype using the _make_Timestamp() function - you can plug in the year and month from your parameter and specify 1 as the day part.  This should then enable you to use all the nice date functions :-)

Regards,

MF.
Title: Re: Calculating YTD with Relational data
Post by: leahmarie on 07 Oct 2011 09:10:48 AM
Thanks so much for the reply! I will definitely try that.:)