diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/transformProps.ts index faf6271302..07ca77547b 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/transformProps.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/transformProps.ts @@ -125,8 +125,10 @@ export default function transformProps( if (compareIndex < sortedData.length) { const compareValue = sortedData[compareIndex][1]; // compare values must both be non-nulls - if (bigNumber !== null && compareValue !== null && compareValue !== 0) { - percentChange = (bigNumber - compareValue) / Math.abs(compareValue); + if (bigNumber !== null && compareValue !== null) { + percentChange = compareValue + ? (bigNumber - compareValue) / Math.abs(compareValue) + : 0; formattedSubheader = `${formatPercentChange( percentChange, )} ${compareSuffix}`;