I need to perform a basic "X to the power of Y" calculation. The calculation builder doesn't accept the ^ character as an operator, so it seems I need to use the Math.Pow(x,y) function.

That would fine if both X and Y were static numbers, but in my case Y needs to be a value that is calculated in a field higher up in the form and is based on user input. Math.Pow() will not accept the field itself as an argument.

Is there any way to do an "X to the power of Y" calculation that uses a calculated value, either with Math.Pow or otherwise?


I'm a developer with Cognito Forms. In your example, what is the type of X and Y? The Math.Pow() function expects to receive 2 Number(Integer) values. If you referencing a Textbox field then you will need to convert the value to a number - Int32(Textbox).

enter image description here

  • For me, X = 1.36 and Y = the value from a Calculation field of the "Number" type called "BoS Calculation". So my calculation is =Math.Pow(1.36,Form.SolarPanels.BoSCalculation). The error message shown is ""No applicable method 'Pow' exists in type 'Math' at character 5" – user2930880 Oct 22 '17 at 17:04
  • BTW I tried the calculation "=Math.Pow(1.36,1.701)" to confirm that using non-integers is not the issue. The function seems to be able to handle decimals, as it outputs the right answer for that. – user2930880 Oct 22 '17 at 17:54

Turns out that along the trail of calculations I was trying to use as an argument for the Math.Pow() function, I was using the "Value" parameters from one of my "Choice" type fields.

The values I'd assigned to the choices in that field could be used in most calculations, but not in the Math.Pow() function.

So I ended up creating a new hidden "Number" type field that returns the correct value based on the choice option selected. Not super elegant, but it's working for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.