If else considering a field grouping

Hi All,

I am trying to put together a table where I can filter out companies with certain characteristic. For example:

I have a field called “Companies” with A-Z companies, and another field with “State” with the branches’ locations. So I want to create a calculated field where I can sum all sales of companies but exclude those companies that don´t have branches in -let’s say- NY.

How can write down such a calculated field?

Thank you!

I would look at cascading filters instead of trying to do this in a calculated field.