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

sql server reporting services

group:

Divide by zero display "0"


RE: Divide by zero display "0" Tokklas
7/25/2005 11:55:02 AM
sql server reporting services:
iif(<field.total>=0,0,<field.numerator>/(<field.total>)

U. Tokklas


[quoted text, click to view]
Divide by zero display "0" Fab
7/25/2005 1:41:23 PM
Hello,

how would I write an if statement to ensure that a "0" is displayed if a
divide 0/0?

Thanks


Re: Divide by zero display "0" Robert Bruckner [MSFT]
7/25/2005 8:13:28 PM
Note: IIF is a function call. All arguments get evaluated before invoking
the function. Therefore, a DivisionByZero can still happen.

Use the following pattern:
=iif( Fields!Total.Value = 0, 0, Fields!X.Value / iif(Fields!Total.Value=0,
1, Fields!X.Value))

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

[quoted text, click to view]

AddThis Social Bookmark Button