Metrics - How to calculate the total duration if status changes from one state to other multiple times

bhargavi7
Tera Contributor

Hi all,

How to calculate total duration ,If we change state from Work in progress to closed.

Scenario is State changed from work in progress to suspended, after that it moved to Work in progress again and moved from work in progress to closed.So,it is in work in progress state 2 times.In metrics,it is creating two records .How to show total duration in duration field through metric scripting without creating new field.

I tried all the script which is in community but not working.

Can anyone share any script 

Thanks in advance.