Tuesday, January 24, 2017

Avoid divide by zero errors in SQL Server Reporting Services (SSRS)

To do this, you just add a function to the report code (in the language VB.NET).



Public Function Quotient(ByVal numerator As Decimal, denominator As Decimal) As Decimal
        If denominator = 0 Then
            Return 0
        Else
            Return numerator / denominator
        End If
End Function


Thanks to: http://williameduardo.com/development/ssrs/ssrs-divide-by-zero-error/