Hello!
I am wondering how to pull a specific value from a repeat. I have a Survey123 that will be used for counting the number of birds present at grouse leks. The survey has a repeat in which the observer documents how many male, female, and unknown grouse are present at the lek at multiple observation times during a survey.
The Survey123 is setup to pull the maximum number of males and the maximum number of females observed at the lek during a survey. However, I also want to know what times the maximum male and maximum female observations occurred, and this is the part I'm struggling with. I want to pull the observation time value from the repeat that is associated with the maximum male count (and the same for females).

I understand the concept of using position(..) and indexed-repeat to retrieve a value from a repeat, but I don't know how to implement them in conjunction with the max() function.
Any help would be appreciated!
Thank you!