I'm trying to convert the value 0,906 to 0,91
Changing the data type and setting max two decimals will not help me since I'm going to do a calculation based on the two data fields.
When I'm doing a calculation to see the difference in percentage in the example below, I will get 1% difference, and that looks very strange since both values are on 91% with 2 decimals.
Value 1: 0,906 | 91%
Value 2: 0,913 | 91%
Value 2 - Value 1 = 0,007 | 1%
I have tried to use Cast((0.906) as numeric(5,2)) and Cast((0.906) as numeric(5,2))
In SQL, this will return 0.91, but in Cognos this returns 0.9
Does anyone know why? And know how I can fix this?
Try abs(0.906) and check if you get the desired result.
Hi,
ABS(0.906) returns 0.906
Am I missing the obvious?
_round([value],2)
should do exactly what you want as a cognos function, or round([value],2) for pretty much any vendor's db function. Casting is for datatype conversions and should not change your value.
Quote from: hespora on 25 Nov 2016 07:55:50 AM
Am I missing the obvious?
_round([value],2)
should do exactly what you want as a cognos function, or round([value],2) for pretty much any vendor's db function. Casting is for datatype conversions and should not change your value.
Thanks!! You are my hero! :)
You're welcome; glad I could help! :)