Count related record, loop in Rulesets?

Hello:

 

We are trying to count related record and save it in a field. After that we need to search values in related record and do math operations with that values (add, total, average) to control values and progress.

 

Best Regards

Marina