How get the count of 2 filtered columns data in CSV?

I have put CSV loop and inside that I have put if condition with variables. Just checking for the below scenario how to get the total count of both.

1- Total count of Receipt and Receipt Notice- When filtered with Receipt updated successfully
2- Total Count of receipt and receipt notice- when filtered with other than receipt updated successfully.
3- If there is no Receipt/Receipt notice found in that column- Count should show as zero.

Attached are files one for CSV page with 2 columns shown, other for the code i have put inside the CSV loop which is not working properly.

Any suggestion would be helpful.