I'm not sure what the problem is with the information provided but did you set the named query Query Type to Scalar Query? That will return a single value rather than a dataset.
You can demonstrate the difference by running a simple query such as SELECT 17 AS myData
in the named query editor and test it with Query Type set to Query and then Scalar Query.
You are using an aggregate function. Aggregate functions will return a row even if there are no rows matching the where clause. You can't use a Scalar Query mode to provide a fallback because that only kicks in when there's no rows returned.
I recommend adding an outer query to the named query that uses coalesce to provide a zero.