sql - How to check for NULL values when using the SUM function in SSRS -


by default, sum function in ssrs excludes nulls. want able check null values in details group , throw error in summary group. in details view use check nulls:

=iif(isnothing(fields!equityprice.value)) ,"#error", fields!equityprice.value*fields!equityshares.value) 

this works desired.

when use in summary section, ignores nulls , returns sum of non-null values. want return "#error" instead:

=iif(isnothing(sum(fields!equityprice.value))) ,"#error", sum(fields!equityprice.value*fields!equityshares.value)) 

i have tried eliminating sum in "isnothing" expression no avail. appreciated. in advance!

so confirm, if there @ least 1 null value in group, #error should displayed?

you can use following summary expression:

=iif(sum(iif(isnothing(fields!equityprice.value),1,0)) > 0   , "#error"   , sum(fields!equityprice.value * fields!equityshares.value)) 

this creates count of null values - if count greater zero, return #error.

i made simple report test:

enter image description here

enter image description here

this uses expression @ detail level , mine @ summary. errors group 1 null value required:

enter image description here


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -