Using SQL Server Reporting Services, if a value in the database is zero, the following format expression with convert it to --- properly to 2 decimal places:
,0.00;(#,0.00);'---'
However, if the value is 0.001, and the report needs to display to 2 decimals (i.e. should show 0.00) the resulting format --- still shows up in the report.
Is there a way to avoid these rounding issues in SSRS and if so what would the new format/function/etc be? The result should be 0.00 for 0.001.
It's an interesting one. I replicated your results:
For the last column I used the following expression in the TextBox:
This gives the results you require.
Looks good, right? Maybe... For displaying on a web page or exporting to PDF I think this is fine, if annoying, but for exporting to Excel, since you're using
Format
, a string is explicitly returned in the report and hence will be a string in the Excel export, as opposed to be exported as a number as it would be in the first three columns.Only you can say if this will be a problem in your environment.
I don't think there is a way to get around SSRS treating small numbers as zero, so handling it in the Textbox itself might be your only option.