Add count logic for no filter queries