Display Zero instead of NULL in SSRS reports

7
56578

Friends,

In this post lets see how to display 0(Zero) instead of NULL in ssrs reports. Very frequently you will be getting NULL values from database for many line items in reports as  shown below. The NULL values will be shown as BLANK which degrades the Look and Feel of the report.

How to fix this then ? One easy was is check for nulls in nthe database and replace it will 0(Zero) using similar code like the given below.

select isnull(columnname,0) as columnname from tablename

You can also use expressions to acheive the same in SSRS and PFB the steps involved in the same.

  • Right click on the Sales amount text box as shown below and select Expression.

  • You will have the EXPRESSION as show below.

  • Change the Expression to the one given below.

=iif(isnothing(Sum(Fields!SalesAmount.Value)),0,Sum(Fields!SalesAmount.Value))

  • Repeat the same for the TaxAmt column too.
  • Now preview the report and you can see ZEROES in the place of BLANKS.

In the above given expression, ISNOTHING() function checks whether the value is NULL or not and if it is NULL thrn the value will be replaced by ZERO.

That isit guys .. Happy Coding !!

Regards,
Roopesh Babu V

7 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

− four = two