How to calculate how many time one answer was selected from a multiple_select

how to calculate how many times a particular answer was selected from a multiple_select in a repeat .

The high level strategy is to filter just the repeats that have that answer selected using the selected function and then count those.

In XLSForm, if the repeat is called my_repeat, the select in the repeat is called my_select and the choice you’re looking for has name desired you would do something like count(${my_repeat}[selected(./my_select, ‘desired’)]).

The part in [ ] brackets establishes a filter. You could put any expression that evaluates to true or false in there.

3 Likes