I can be wrong but, if I understand the request correctly, it's a pretty easy feat.
You just have to create a second relationship with the same link as the other, plus all the request you need. Then it's just a matter of using the new TO instead of the old one.
Let's hypnotize to have an Invoices table and a Rows table and their relationship is based on
In Rows we have two field: color and quantity. We want, from the Invoices table, to count the rows with quantity=2 and color=red.
We just need two field in the Invoices table to store our filters (they can be constants, user input or scripted input, it really doesn't matter): after having created Invoices::filter_quantity and Invoices::filter_color, we can create a new TO for the Rows table (called FilteredRows) and match it with our Invoices table based on
Invoices::id=Rows::id_invoice, Invoices::filter_color=Rows::color and Invoices::filter_quantity=Rows::quantity.
Now we can count the rows (from the Invoices table) using
Count ( FilteredRows::id ).
With all that done, we just need to put a value into the filter fields and create a field into the Invoices table to store the result of our Count() function.