Adding a constraint on the sum of a repeat group

I already answered your similar question Repeat Groups Calculations can't you just use that form and remove repeat_count?