diff --git a/src/utils/index/CalculatePercentage.ts b/src/utils/index/CalculatePercentage.ts index dc4cf3af3..bf37861da 100644 --- a/src/utils/index/CalculatePercentage.ts +++ b/src/utils/index/CalculatePercentage.ts @@ -5,9 +5,11 @@ export function CalculatePercentage( if (value1 === undefined || value2 === undefined) { return ""; } - if (value2 === 0) { + + const result = value1 / value2; + if (isNaN(result)) { return "0.00%"; } - return `${((value1 / value2) * 100).toFixed(2)}%`; + return `${(result * 100).toFixed(2)}%`; }