vb.net 如何在rdlc报告中舍入十进制值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30595248/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to round decimal value in rdlc reports
提问by user3004110
I using a simple formula in rdlc report. I want to use the forward rounding for example i have value 25.17 and i want to convert into 26 not 25. But following formula giving me the result = 25.
我在 rdlc 报告中使用了一个简单的公式。我想使用前四舍五入,例如我的值是 25.17,我想转换成 26 而不是 25。但是下面的公式给了我结果 = 25。
=ROUND(Sum(Fields!Total.Value, "DataSet1") + First(Fields!Shipping.Value, "DataSet1") - First(Fields!Discount.Value, "DataSet1"),0)
Thanks in advance
提前致谢
回答by tezzo
In your Expression, use Ceilingfunction instead of Round.
在您的 中Expression,使用Ceilingfunction 而不是Round.
=Ceiling(Sum(Fields!Total.Value, "DataSet1") + First(Fields!Shipping.Value, "DataSet1") - First(Fields!Discount.Value, "DataSet1"))
回答by Andreas Kruhlmann
Most programming languages have a Round, Floorand Ceilingfunction. Floor rounds down, ceiling up and round to the nearest.
大多数编程语言都有Round,Floor和Ceiling函数。地板向下四舍五入,天花板向上并四舍五入到最近的位置。
Further reading for the ceiling function https://msdn.microsoft.com/en-us/library/system.math.ceiling%28v=vs.110%29.aspx
进一步阅读天花板函数https://msdn.microsoft.com/en-us/library/system.math.ceiling%28v=vs.110%29.aspx

