Hi,
Can someone help me with percentage calculation script?
I have written a java script to calculate the percentage for particular operations which is already reporting. Like i have need to calculate success(%), Error(%) and Warning(%). Have written a script based on below calculation and its reporting in investigator successfully
TotaltranscationCount=ParseInt(Success+Error+Warning);
SuccessCount=parseInt(totalSucessCount) + parseInt(value);
successPercent=Math.round((parseInt(totalSucessCount)/parseInt(TotaltranscationCount))*100);
Similarly for Error and Warning Percentage.
The issue is whenever am viewing in investigator, i can see Success Percentage as 99%, Error as 4% and Warning as 12%.
Ideally the sum of all these percentage should be 100%. Am sure my percentage calculation is correct. Have enabled the logging and checked the logs from back end it shows correctly as below or similar. I looked for particular time interval say 1hour and live also both show wrongly.
totalSucessCount ==> 3044
totalWarningCount ==> 145
totalErrorCount ==> 38
totalTraxCount ==> 3227
successPercent ==> 94
warningPercent ==> 5
errorPercent ==> 1
I think the calculation is for every 15 seconds.
Can someone help me what am missing in my script?
Thanks