COGNOiSe.com - The IBM Cognos Community

Legacy Business Intelligence => COGNOS Impromptu => Topic started by: bt2133 on 28 Aug 2006 01:58:03 PM

Title: Converting a Date Calculation to a number/string
Post by: bt2133 on 28 Aug 2006 01:58:03 PM
I have 2 dates that I am subtracting from one another to get a date difference (lag days) (e.g., 12/2/06 - 12/1/06 = 1 day).Ã,  The end result gives me the correct number of days, however it is in date 'd' format. I would like to use this data as a number but I can't convert it .Ã,  I need to keep it in Impromptu so that I can build a cube using TransformerÃ,  later.Ã,  How can I convert the end result (e.g., 1 day) to a number?

I appreciate any help you can offer.

Thanks,
Brian
Title: Re: Converting a Date Calculation to a number/string
Post by: MFGF on 29 Aug 2006 07:27:35 AM
The result of subtracting two dates is an interval (days, hours, mins, seconds and thousandths), although Impromptu does not display the time part in your report.  To get hold of the day part of the interval and use it as a number, use the day function: eg day(12/2/06 - 12/1/06) will give you an integer result.

Regards,

MF.
Title: Re: Converting a Date Calculation to a number/string
Post by: bt2133 on 29 Aug 2006 08:36:38 AM
Looks like that did the trick. Thanks!

Brian