How do you trigger a question when a repeat group, previous to it, has the same selection?

1. What is the problem? Be very detailed.

2. What app or server are you using and on what device and operating system? Include version numbers.
I am using the kobo builder + xls form.
3. What you have you tried to fix the problem?
I have tried summing the specific selection with total count of repeat group but it didn't work out because of probably wrong syntax.
4. What steps can we take to reproduce the problem?

5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.

Hi, is it possible to attach an xlsform with your question or even a relevant section of an xlsform if you prefer not to share the whole thing?

my guess is the indexed-repeat and position(..) functions would be needed but it could get tricky if the number of possible repeats is large as there would be a lot of combinations to check through then.