Skip to main content
Participating Frequently
November 2, 2022
Answered

Pay Increase Percentage Calculation

  • November 2, 2022
  • 2 replies
  • 877 views

Hello,

 

I'm needing to create a calculation to determine the pay wage percentage increase on a form. I'm struggling with the formula/calculation needed. I am getting an error stating that the field doesn't match the output.

 

Essentially needing, =((HourlyEmployeesNewPayRate-CurrentPayRate)/CurrentPayRate)*1

 

 

This topic has been closed for replies.
Correct answer Nesa Nurani

As mentioned above you need custom calculation script, something like this:

var a = Number(this.getField("HourlyEmployeesNewPayRate").valueAsString);
var b = Number(this.getField("CurrentPayRate").valueAsString);
if(b)
event.value = ((a-b)/b)*1;
else
event.value = "";

What is the point of multiply by 1?

If you set field format as percentage, then instead of multiply by one, you need to divide by 100.

2 replies

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
November 2, 2022

As mentioned above you need custom calculation script, something like this:

var a = Number(this.getField("HourlyEmployeesNewPayRate").valueAsString);
var b = Number(this.getField("CurrentPayRate").valueAsString);
if(b)
event.value = ((a-b)/b)*1;
else
event.value = "";

What is the point of multiply by 1?

If you set field format as percentage, then instead of multiply by one, you need to divide by 100.

Participating Frequently
November 2, 2022

Thank you!

try67
Community Expert
Community Expert
November 2, 2022

This will happen when the divisor is empty, as it would be division by zero. You need to use a script that checks that the field is not empty (or zero) first, and then perform the calculation.

Participating Frequently
November 2, 2022

Thank you!!