Add a column to the table with items that you want to count.
Use the following formula (and adjust {Field Name}, “x” and “y” to your parameters)
IF(AND(FIND("x", {Field Name}) > 0, FIND("y", {Field Name}) > 0), 1, 0)
Then on your other table, add a Rollup field that looks at this field and sums the values.