Search code examples
reporting-servicesssrs-2008-r2ssrs-expression

Using IIF and AND in SSRS Expression


I have a table like below

enter image description here

I want to hide the rows where ALL 3 columns are 0. All the columns are of INT data type

My expression is like so:

    =IIF((Fields!PastVal.Value=0) AND (Fields!DatePay=0) AND (Fields!Line.Value=0),False,True)

But no data is returned except the column label(heading). What could be wrong with my express?


Solution

  • Are you using Row Visibility? The True or False is for Hiding the Row yet you set it to false if they equal 0.

    =IIF((Fields!PastVal.Value=0) AND (Fields!DatePay=0) AND (Fields!Line.Value=0), True, False)
    

    That still doesn't fix the issue though - some columns should have been displayed since you have data in your example.

    Are your data rows using SUM? If so, your expression would need to SUM also.

    =IIF(SUM(Fields!PastVal.Value) = 0 AND SUM(Fields!DatePay.Value) = 0 AND SUM(Fields!Line.Value) = 0, True, False)