I can’t understand the difference between count and sum
I’m trying to get the number of rows for a specific condition of my report and always I get 0 using count or sum
columnA columnB
0 my string
0 none
0 my string
0 none
1 none
=IIF((Fields!columnA.Value = "0" and Fields!columnB.Value = "none"), SUM(Fields!columnA .Value),0)
I want to get 2 as a result
I can’t see my error
SUM() will return the total of the values in that field, while count will return the number of non null values.
So in the example you provided,
=SUM(Fields!columnA.value)should return 0 and=COUNT(Fields!columnA.value)should return 5. [ But your IIF statement makes it sound like this is in a location where the scope is a single row, so then the count and Sum will only be applied to that row. If you want to scope the expression for the entire group, add a scope parameter to your aggregate function, such asCOUNT(Fields!columnA.value, "MyDataSetName")]Since you aren’t seeing this result, there are a few things you can check:
you are getting a null value back?
somewhere where the scope matches what you expect? That is, if you
want it to count all rows in your data set are you using it in a top
level textbox or group total?
Also, simplify to debug: place the individual components of your IIF statement in different cells, so that you can verify that the values match what you think should be happening.