I'm trying to build an RDLC report but the round function seems to return wrong results for some numbers.
The following code =Round(23.545, 2) returns 23.54 but obviously, it should return 23.55.
Any ideas about what's wrong here? What can I do to do correct rounding in my report?
Related
I am new to crystal and still learning, I have the following formula field in crystal
IF ISNULL({command.Step1}) AND ISNULL({#step1 15 day check}) THEN ToText({command.step1Due}, 'MM/dd/yyyy') ELSE ToText({command.step1}, 'MM/dd/yyyy')
I keep running into error message that says "Too many arguments have been given to this function" I was curious if there was a work around.
{command.step1Due} and/or {command.step1} are not DATE data type.
Because of that, the ToText() function doesn't know what to do with the date formatting argument.
The number type is double. I have checked that:
331.83319305/884.8885148=0.375
but vb.net gives an answer of 0.37499999999999994.
Any ideas?
I have written an expression to get gross profit margin as follows.
=IIF(Sum(Fields!AugustValue.Value, "GrossProfitDataSet")-1>0 AND Sum(Fields!AugustValue.Value, "GrossSalesDataSet")-1>0,ROUND(((Sum(Fields!AugustValue.Value, "GrossProfitDataSet")-1)/(Sum(Fields!AugustValue.Value, "GrossSalesDataSet")-1))*100,2) & "%","0.00")
it shows #Error when the Sum(Fields!AugustValue.Value, "GrossProfitDataSet")-1 and the Sum(Fields!AugustValue.Value, "GrossProfitDataSet")-1 has zero. I have handled the zero values. Someone please help men to find the error
It is your Conversion related error. You need to convert AuguestValue to your desired any numeric data type if this not in numeric. Try with following expression
=IIF(Sum(Fields!AugustValue.Value, "GrossProfitDataSet")-1>0 AND Sum(Fields!AugustValue.Value, "GrossSalesDataSet")-1>0,ROUND(((Sum(Fields!AugustValue.Value, "GrossProfitDataSet")-1)/(Sum(Fields!AugustValue.Value, "GrossSalesDataSet")-1))*100,2) & "%","0.00")
hi I'm trying to finish a crystal report, summary report, but I'm getting division by zero error. I've looked up everything and none of the options have helped me. The options already out there have only made my math formula turn everything to a zero.
if 1-({#dspStkWip}+{tblItem.OnOrderQuantity}/{#dspNeed})*100 > .15
then crYellow
else CrNocolor;
So whats happening since the need has zeros in the column it will end up making everything 0. I just need to find a way to implement a check for zero and to see if it needs to be highlighted in the column.
The {#dspNeed} field looks like the culprit to me. If this field contains 0 or NULL values then you would get the division by zero error you described.
Try this:
IF {#dspNeed} <> 0 THEN
if 1-({#dspStkWip}+{tblItem.OnOrderQuantity}/{#dspNeed})*100 > .15
then crYellow
else CrNocolor
ELSE
\\ code for how to handle values that throw division by zero error goes here
I am writing a report in SQL Server 2005 Reporting Services, involving the division of money values that might be equal to zero. I put the following code in to check for a zero denominator:
=IIf(Sum(Fields!PreviousPremiumMTD.Value) = 0, "N/A", FormatPercent((Sum(Fields!PremiumMTD.Value) / Sum(Fields!PreviousPremiumMTD.Value))-1, 0))
However, for some reason I am still getting #Error displaying on my report with the following warning thrown:
[rsRuntimeErrorInExpression] The Value expression for the textbox ‘textbox62’ contains an error: Attempted to divide by zero.
Any assistance is greatly appreciated.
IIF evaluates the expression before passing that to function, thats why you will always get the DivideByZero error here.
See an example post: http://secretgeek.net/iif_function.asp