Reputation: 4929
What am I doing wrong when using the Round() function? In the end I'm trying to return a number to show a dollar figure (not the data type just the format of $####.## as an example).
When I use the Round() function the following way it works fine and rounds up...
=Round(125.239, 2)
Output would be 125.24
The Round() function I'm using in the Expression is the following...
=Round(125.239, 2, 1)
For some reason that throws an error.
Argument matching parameter 'mode' narrows from 'Integer' to 'System.MidpointRounding'
What am I doing wrong? To add to my question, I should say that I'm trying to use "1" as the third param to ROUND DOWN the output getting "125.23" as the end result.
Upvotes: 0
Views: 546
Reputation: 126
Can we see more of your code, Does it work if you just put in:
SELECT ROUND(125.239, 2, 1)
Rounding down is more of a truncate. The ROUND feature should work for you, but if you just use:
ROUND(125.239, 2, 1)
It will return 125.230. If you want it formatted correctly, I would do it like this:
CAST(ROUND(125.239, 2, 1) AS DECIMAL(18,2))
This returns 125.23. This will truncate the number to 2 decimal places with a following zero, then format it in the way you want.
Upvotes: -1
Reputation: 95689
SSRS uses the VB.Net functions, so instead try:
=Round(125.239, 2, MidpointRounding.AwayFromZero)
Reference: MidpointRounding Enum
Edit:
Based on the OP's comment, what that are actually after is the value correct to 2 decimal places, not rounded. This can be achieved by doing the following:
=Floor(125.239*100) / 100
Upvotes: 4