Count Function
Any idea why it is not counting null field
=Count(IIF((Fields!GrantTotal.Value) =
"0",1,Nothing))
simam
November 4th, 2011 8:12pm
Null is not equal to 0. If you need to check for null values, use IsNothing
=Count(IIF(IsNothing(Fields!GrantTotal.Value) OR (Fields!GrantTotal.Value) = "0",1,Nothing))
Free Windows Admin Tool Kit Click here and download it now
November 4th, 2011 9:51pm
JL,
Thank you , how about If I like to check for null values count.
=Count(Fields!GrantTotal.Value)
Thank yousimam
November 5th, 2011 8:23am
The COUNT function counts all values EXCEPT for null/nothing. To count the number of null values:
=Count(IIF(IsNothing(Fields!GrantTotal.Value),1,Nothing))
I believe this should also work (not tested)
=Sum(IsNothing(Fields!GrantTotal.Value))
Free Windows Admin Tool Kit Click here and download it now
November 5th, 2011 8:28am
JL
I like to count number of grant even if row is null.
Grant
Null
1
2
3
Count should be 4.
Thank yousimam
November 5th, 2011 8:46am
So basically, you want to count the number of rows? Try
=Count(1)
Free Windows Admin Tool Kit Click here and download it now
November 5th, 2011 8:47am
Yes I like to count the number of rows.
Right now I am using
Count(Field.Grant.Value) but it is not picking the null rows.
Thank yousimam
November 5th, 2011 9:32am
As mentioned, COUNT function does not include null values. Try using a constant value as parameter instead.
i.e.
=COUNT(1)
Free Windows Admin Tool Kit Click here and download it now
November 5th, 2011 9:34am
Sorry , I am not getting
=count(1) - where is the field name
like I have = Count(Field.Grant.Value)simam
November 5th, 2011 10:03am
Why do you need to specify the field name if you are counting all records? Or maybe you want to count distinct/unique values? If so, try
=CountDistinct(Iif(IsNothing(Field.Grant.Value),"",Field.Grant.Value))
Free Windows Admin Tool Kit Click here and download it now
November 5th, 2011 10:34am