简体   繁体   中英

Using IIF and AND in SSRS Expression

I have a table like below

在此处输入图片说明

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?

Create a filter on the tablix, where you simply add 3 conditions, one for each of the 3 fields:

在此处输入图片说明

Use the <> as operator on each condition, and simply specify 0 as the Value rather than using an expression.

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)

Thanks everyone for your kind suggestion. My expression was right all the while, but because I had a grouping on my report, I had to to set the Visibility through the Group Properties by clicking on Details. Prior to that, I was applying the filter by right clicking the detail row in the report body but that did not work.

Thanks everyone for your contribution. My fault. My report had a group level and because I was applying the filter by right clicking on my tablix, that did not work. I had to do it by right clicking on Detail in the Row Group.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM