COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Rohini Suryawanshi on 29 Sep 2016 02:57:28 AM

Title: How to round a value of 4.53% to 4% using Report studio in cognos 10?
Post by: Rohini Suryawanshi on 29 Sep 2016 02:57:28 AM
Hi,

How to round a value of 4.53% to 4 %,  4.44% to 4% using Report studio in cognos 10?

As, I have tried to use round function but it rounds a value in such a way like, 4.53% to 5% and 4.44% to 4%. But I dont want in this way.
Even I tried to use trunc function, but it is giving some unexpected result like 0.00% for 4.53%, 0.00% for 4.44%. Please suggest for the same.



Regards,
Hermoine Granger

Title: Re: How to round a value of 4.53% to 4% using Report studio in cognos 10?
Post by: MFGF on 29 Sep 2016 03:24:22 AM
Quote from: Rohini Suryawanshi on 29 Sep 2016 02:57:28 AM
Hi,

How to round a value of 4.53% to 4 %,  4.44% to 4% using Report studio in cognos 10?

As, I have tried to use round function but it rounds a value in such a way like, 4.53% to 5% and 4.44% to 4%. But I dont want in this way.
Even I tried to use trunc function, but it is giving some unexpected result like 0.00% for 4.53%, 0.00% for 4.44%. Please suggest for the same.



Regards,
Rohini Suryawanshi

Hi,

You could try using the floor() function - this ought to give you what you need.

Cheers!

MF.
Title: Re: How to round a value of 4.53% to 4% using Report studio in cognos 10?
Post by: dax on 29 Sep 2016 03:26:12 AM
Take a look at the Floor function.  It rounds numbers down to the nearest integer so you might have to do some arithmetic to get it working e.g.

floor([Your calculation or data item]*100)/100

Dax

Edit: Too slow :)
Title: Re: How to round a value of 4.53% to 4% using Report studio in cognos 10?
Post by: MFGF on 29 Sep 2016 03:35:41 AM
Quote from: dax on 29 Sep 2016 03:26:12 AM
Take a look at the Floor function.  It rounds numbers down to the nearest integer so you might have to do some arithmetic to get it working e.g.

floor([Your calculation or data item]*100)/100

Dax

Edit: Too slow :)

Lol. Unless you can type at the speed of a bullet train, I posted my answer as you were finishing up yours. It's far better to get two answers that agree than two that contradict, and in fact your answer has much more useful detail than mine. :)

Cheers!

MF.
Title: Re: How to round a value of 4.53% to 4% using Report studio in cognos 10?
Post by: Rohini Suryawanshi on 29 Sep 2016 04:36:52 AM
Thanks guys... it was helpful.