If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Ceiling or Somethiing Similar

Started by BigOCombe, 18 Apr 2013 08:19:02 AM

Previous topic - Next topic

BigOCombe

Hello Group,

In Excel there is a formula called Ceiling that rounds a number up, to the nearest interger or to the nearest multiple of significance. Cognos has a Ceiling function but it only Returns the smallest integer that is greater than or equal to "numeric_expression". So if I have sales of 1, 2, or 3 I would like to round to 4; sales of 5, 6, or 7 round to 8; etc... Any suggestions on how to accomplish this?

Thanks!
BigOCombe

calson33

You could use something like a case statement and mod:

case when mod(sales,4) = 0 then sales
else sales + (4-mod(sales,4))
end

BigOCombe

Thanks calson, that work perfect.

calson33

After thinking about it, you don't even need the case statement. just
sales + (4-mod(sales,4)) will do.