confusedMind
confusedMind

Reputation: 2653

Rdlc reporting issue expresssion in report not running

I created 4 reports all of them worked i have an expression in all to count rows:

=IIF(Fields!Logged30Days.Value = "yes", Count(Fields!Logged30Days.Value),0)

But today i see on all this is returning 0 when there are rows in the report it suddenly stops working how to fix this and why is it happening?

UPDATE

Now i see the expression are not working on any report, even on the earlier backup versions where they worked!

And if i do this it works but for all the rows just to show expression works ! but its not working as it did before above.How do i change this below to get desired result.

=IIF(Fields!Logged30Days.Value = "yes", count(Fields!Logged30Days.Value),count(Fields!Logged30Days.Value))

Upvotes: 0

Views: 1193

Answers (1)

Ian Preston
Ian Preston

Reputation: 39606

OK, it seems like all you need is the following expression:

=Sum(IIf(Fields!Logged30Days.Value = "yes", 1, 0)

All this is doing is counting the rows with a yes value for Logged30Days; it the value is not yes it's just ignored for the count.

In your case,

=IIF(Fields!Logged30Days.Value = "yes", Count(Fields!Logged30Days.Value),0)

is the same as:

=IIF(First(Fields!Logged30Days.Value) = "yes", Count(Fields!Logged30Days.Value),0)

i.e. when there is more than one row in the Scope but no aggregate specified it will just take the first row. So the expression was determined by the first row's value only. Also, when the first value was yes the Count would count all rows, even those where the value was not yes, which was also not quite what you were after either, I think.

Upvotes: 1

Related Questions