Managed to solve it myself. Thought I send the solution if someone else have similar problems. Paste this code into the Set equation window field:
(function() {
sum = fieldname55;
for (let i = 1; i < fieldname47 ; i++ ) {
sum = sum + fieldname55*POW(fieldname46,i)
}
return sum
})();
If the webpage is buggy and removes your code, and replaces it with [object Object], just log out and log in again, maybe refreshing the page solves that issue as well.
Best regards Christoffer