Validate errors: dependency cycles amongst the xpath expressions

I am working on amending the sum function as you have advised in your previous forum post. I will post here how it goes. Thank you for your help. Much appreciated.