COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: jjacob on 17 Oct 2016 05:07:52 PM

Title: Trucate a number
Post by: jjacob on 17 Oct 2016 05:07:52 PM
I need to show a number as a whole without rounding it.  Changing the decimal setting to "0" performs rounding.  I've attempted to use function TRUNC with no success.

Ideas/Suggestions?
Title: Re: Trucate a number
Post by: BigChris on 18 Oct 2016 02:09:54 AM
You could try casting it as an integer, or use the Int function.
Title: Re: Trucate a number
Post by: Lynn on 18 Oct 2016 02:38:24 AM
Or maybe the floor function.
Title: Re: Trucate a number
Post by: jjacob on 18 Oct 2016 03:56:45 PM
I did get this to work late yesterday by casting as an integer.  Thanks for the help!
Title: Re: Trucate a number
Post by: MFGF on 19 Oct 2016 05:44:01 AM
Quote from: jjacob on 18 Oct 2016 03:56:45 PM
I did get this to work late yesterday by casting as an integer.  Thanks for the help!

I'd expect Lynn's floor() function suggestion would be a more efficient solution than using a cast() function?

Cheers!

MF.
Title: Re: Trucate a number
Post by: AnalyticsWithJay on 19 Oct 2016 06:58:04 AM
Quote from: MFGF on 19 Oct 2016 05:44:01 AM
I'd expect Lynn's floor() function suggestion would be a more efficient solution than using a cast() function?

Cheers!

MF.

I agree with MF's statement. Be careful with using Cognos' cast() function because it's a locally processed function. It will not be as efficient as floor(), which is sent to the DB for processing.