• What you've run into is not necessarily an SSRS issue although it manifests itself there a lot. Especially when using IIF to catch divide by zero conditions.

    The problem is with the IIF function in VB.net.

    In BOL, under Visual Basic Language Reference - IIf Function

    (http://msdn.microsoft.com/en-us/library/27ydhh0d(VS.71).aspx)

    it offers the following remark,

    "The expressions in the argument list can include function calls. As part of preparing the argument list for the call to IIf, the Visual Basic compiler calls every function in every expression. This means that you cannot rely on a particular function not being called if the other argument is selected by Expression."

    So...what's happening is, regardless of your trying to condition away the erroneous 'MONTHNAME(100)' condition, the compiler still sees it and throws the #error.

    The two most common workarounds are to either write a custom code function that accomplishes your end and then use it instead of the IIF or use a nested IIF in your 'false' condition. This second option works because the compiler does read from the most nested conditions outward.

    Given what you're trying to accomplish, I suggest a third option. try using the SWITCH() function. If you go to the link above, a link for SWITCH can be found at the bottom under See Also.

    HTH

    [font="Comic Sans MS"]toolman[/font]
    [font="Arial Narrow"]Numbers 6:24-26[/font]