Count Only Non-Zero Values

S

Samantha

Is there a way to count only non-zero values in a query, and ignore zero
values? The numeric field is substituted with 0 (zero) if it's null. Any
pointers are greatly appreciated. Thanks.
 
K

Ken Snell \(MVP\)

Substituted by what means? Nz function? Or by Format property? Show us an
example of the query that you're trying to use.

In general, one can count such things by using a Sum aggregate function in
this way:

SELECT Field1, Sum(IIf(Field2 Is Null, 0, 1)) AS NonNullCountField2
FROM TableName
GROUP BY Field1;
 
Top