diff --git a/src/utils/index/CalculatePercentage.ts b/src/utils/index/CalculatePercentage.ts index dc4cf3af3..a74195e5b 100644 --- a/src/utils/index/CalculatePercentage.ts +++ b/src/utils/index/CalculatePercentage.ts @@ -2,12 +2,10 @@ export function CalculatePercentage( value1: number | undefined, value2: number | undefined, ): string { - 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)}%`; }