The problem you are seeing is a known issue specifically with how Enketo handles references within nested repeats. The workaround is that with Enketo you have to use an explicit relative path to the XML element being summed in the nested repeat (instead of the usual ${foo} which basically becomes an absolute path…). This is probably best explained just by giving you the code
Take a look at this form, it should correctly sum values from the inner and outer repeat groups accordingly.