Will79
(Will)
#1
Lets say I have the numbers

10.5

10.2

10.49

I want them all to round up to 11. However, if the numbers are

10

10

10

I want them to stay the same. How can I get this done in SSRS. Can’t seem to get the round function to do what I want it to do.

Evan_Purdy
(Evan Purdy)
#2
It sounds like you want the CEILING function

4 Likes

ckrusen
(Calvin Krusen)
#3
Look into the details of the CEILING function (and its compliment FLOOR), to see how they handle negative numbers to make sure they don’t trip you up.

CEILING(-5.5) yields -5, not -6

2 Likes

bordway
(Bruce Ordway)
#4
If you want ANYnumber with a decimal to round up to the next WHOLE number…

Maybe something like this example for Part.UnitPrice…

(case when Part.UnitPrice - convert(decimal,convert(int,Part.UnitPrice)) > 0 then convert(decimal,convert(int,Part.UnitPrice)) + 1 else convert(decimal,convert(int,Part.UnitPrice)) end)

1 Like

ckrusen
(Calvin Krusen)
#5
@bordway - your formula does exactly what CEILING() does

```
CEILING(5) = 5
CEILING(5.5) = 6
CEILING(0.5) = 1
CEILING(0) = 0
CEILING(-0.5) = 0
CEILING(-5) = -5
CEILING(-5.5) = -5
```

1 Like

bordway
(Bruce Ordway)
#6
Yes, it’s a Rube Goldberg version of CEILING

3 Likes

Will79
(Will)
#7
So, if it is 5.2 then Ceiling(5.2) = 6 correct?

ckrusen
(Calvin Krusen)
#8
Yes. And FLOOR(5.999) = 5