all groups > sql server reporting services > october 2005 >
You're in the

sql server reporting services

group:

Table Help


Table Help Nat Johnson
10/10/2005 7:04:01 PM
sql server reporting services:
Have a table that is requiring a percentage column.
No probs there, have it and its working. Problem is ...if the columns in
the expression have a "0" value then it shows "NaN". How do I get around
this. I want to only show 0.00 in the field.

Note that the expression is on the textbox not in the sql query.

=sum(Fields!FebruaryG5.Value) / (sum(Fields!FebruaryG5.Value) +
sum(Fields!FebruaryL5.Value)) * 100

Basically if it returns "NaN" i want to display 0.00.


RE: Table Help Nat Johnson
10/10/2005 7:07:03 PM
Oops I thought I could try something like this but it hasn't worked.....any
thoughts???

=if (sum(Fields!JanuaryG5.Value) + sum(Fields!JanuaryL5.Value)) > 0
then sum(Fields!JanuaryG5.Value) / (sum(Fields!JanuaryG5.Value) +
sum(Fields!JanuaryL5.Value)) * 100
else 0)end

[quoted text, click to view]
Re: Table Help Robert Bruckner [MSFT]
10/15/2005 7:29:26 PM
You could use custom code and define a VB function that uses
if-then-else-endif.
Alternatively, if you want to use RDL expressions, you can use the IIF
function. Since IIF is a function it will evaluate all arguments before
executing the function. This causes the division by zero. In general, for
the IIF function you would always want to use the following pattern:
=iif( B = 0, 0, A / iif( B = 0, 1, B))

-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.


[quoted text, click to view]

AddThis Social Bookmark Button