Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

#Error Handling in SSRS when add sum in expression

$
0
0

Hi,

I am working on a report and in one of the fields  is

=(ReportItems!Textbox1.value-ReportItems!Textbox2.value)

/(ReportItems!Textbox1.value+ReportItems!Textbox2.value)

which is the division of previous 2 fields and if i have any values for these fields then i get the correct value,but if i dont have any values for the previous 2 fields i mean if they are empty then it returns me #ERROR.

So finally i used VB.Net code like below

Public Shared Function VarPercent(ByVal Actual As Decimal, ByVal Budget As Decimal) As Decimal
If Budget = 0 Then
Return 0
End If
Return (Actual / Budget)
End Function

Use Expression as below

=code.varpercent(ReportItems!Textbox1.value-ReportItems!Textbox2.value)

/(ReportItems!Textbox1.value+ReportItems!Textbox2.value)   its worked nicely.

See My problem is When i try to add SUM  of fields like below,

=code.varpercent(sum(ReportItems!Textbox1.value-ReportItems!Textbox2.value))

/sum((ReportItems!Textbox1.value+ReportItems!Textbox2.value)  )

Am getting # error,How can i SUM the above expression?

Any suggestions please?

Thanks,

Samba



Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>