All I can see from what you've posted so far is the check for:
activeclient > 0
in the subquery (patient count) but not in the outer query (attendance count).
It seems possible to me that the patients that made up the attendance count are no longer active in that shelter?!
SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.