Hi Jonathan,
If you mean that not all documents are considered, please check two things:
- Use the ISNULL function directly on fields, instead of on the outcome of a complete query or calculation. So for example SUM(ISNULL(DocTotal,0) - ISNULL(PaidToDate,0))
- Using ISNULL on a complete query will not work if the query returns an empty result set. You could incorporate something like CASE WHEN (SELECT COUNT(*) FROM [and the rest of your query here]) = 0 THEN etc. to catch this.
Regards,
Johan