Repeat group depend on Checkbox lookup answers

HI
I'm using lookup table with filter applied and i want to add repeat group based on selected choices from checkbox lookup table question so, i want to ask the same set of questions for each selected choice , i tried to use this example:
https://confluence.dimagi.com/display/commcarepublic/Advanced+Functions+for+Repeat+Groups
But still i need to change the repeat count to meet the number of selected
please help
Thanks