Please download the sample form from here. https://acrobat.com/#d=Xxh9tEdKkYuByNDdKR4Geg
1. Place the below code in the calculate event of your total field.
TotalField.rawValue = Sum(instance[*].price)
Make sure the script selected under language is formcalc.
Also to Verify at least one instance of the numAmount field exists.
You can check the object panel of the subfom and under Binding TAb you can check the option "Repeat subform for each data item with Min count 1."