0

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)) 
8
  • Is this expression in a Table or Group header row? Commented Jul 2, 2013 at 11:32
  • @IanPreston its on empty space no row no table , but i have expression everywhere inside groups! on group header on blank just dragged and drop to display values etc... But they wont work now i am adding them using parameters so calculate everything on start and its working. But for one with charts i need the expression to make the chart columns i cannot add parameters! Commented Jul 2, 2013 at 11:35
  • @IanPreston the weird thing is its was all working one yesterday .Suddenly all expression on any report wont work even on my client pc which has no link to mine where it all worked. Commented Jul 2, 2013 at 11:36
  • I would check all the values of Logged30Days. What you're effectively doing above is checking the first value of Logged30Days in whatever Scope the expression is... If that is not yes, even if there are yes values elsewhere in the Scope's data, you'll get 0 in the expression. Commented Jul 2, 2013 at 11:55
  • @IanPreston the expression is on value field inside a chart so its bound to automatically do it for all the rows so the above does not apply here i think. Commented Jul 2, 2013 at 12:05

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

So simple :| and perfect.... Just curious mine worked when first row was YES it did the count if first row was no it died what was the issue.
Added a bit more detail, hope it helps.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.