Calculate field value based on other 2 field values for variance value in PPM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2023 03:46 AM
Hi Team,
How to set a field value after calculation based on other 2 fields : for effort variance in PPM
2 fields: Actual Effort & Planned Effort -
in the Effort variance field I need to display after calculation of 2 fields like below formula:
Effort variance = Actual effort - Planned effort/Planned effort *100
Kindly Suggest how to achieve this
Thanks,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2023 09:31 AM
Hello Maneesh,
You're going to need to create 2 OnChange client scripts, 1 that will trigger OnChange of the Actual Effort field and 1 that will trigger OnChange of the Planned Effort field. Each script you're going to need to get the value of the other field (i.e. Actual Effort script you need to grab value of Planned Effort) and perform the calculation. You can then take the answer of the calculation and set the value of the Effort Variance field.
This way if the value changes in either field the variance value will be calculated and correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2023 12:17 AM
Hi Joe,
Thanks a lot for the response and greatly appreciate if you can provide me code samples , it will really help me
Thanks,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2023 07:04 AM - edited 04-26-2023 07:07 AM
Sure,
This is just a sample, but something like this should work.
var act_effort = g_form.getValue('actual_effort');
var plan_effort = g_form.getValue('planned_effort');
var effort_var = '';
//make sure both fields have values
if (act_effort && plan_effort){
effort_var = act_effort - plan_effort/plan_effort*100;
}
g_form.setValue('u_effort_variance', effort_var);
You'll need two identical scripts like this, both OnChange one on actual effort and one on planned effort.