Round Number to the closest bigger Number in SSRS 2008
I have some values like 12345. I would like to round this number to 13000. I am going to use them in the chart axis for more readable interval.
How can I do that?
Here are some example:
124567 Round to : 125000
123 Round to 150 or 200
July 26th, 2012 12:43am
Hi,
If you want to round up the numbers to the level of hudreds, then its better to do in the below way.
Cint(Left(Field.Value,1)) * Power(Count(Field.Value-1)) + (Cint(left(field.Value,2)) + 1) * Power(10,(Count(Field.Value)-2))
The above expression gives for ex number is : 423456
Cint(Left(Field.Value,1)) = 4, Power(Count(Field.Value-1))=100000
so the multiplication gives 400000
(Cint(left(field.Value,2)) + 1) = 3, Power(10,(Count(Field.Value)-2))=10000
So multiplication gives 30000.
Now the sum of both gives 430000. Which is round figure of 423456.
Free Windows Admin Tool Kit Click here and download it now
July 26th, 2012 1:39am
Hi,
I think you can use SQL Server ROUND function in your SELECT statement.
http://msdn.microsoft.com/en-us/library/ms175003.aspx
I hope this is helpful.Please Mark it as Answered if it answered your question
OR mark it as Helpful if it help you to solve your problem
Elmozamil Elamir Hamid
MCTS: SQL Server Administration/Development
MyBlog
July 26th, 2012 1:55am