working filter query on the server for accurate counts