From 784a478268fd89e6e58077e99bb2010987d6b07c Mon Sep 17 00:00:00 2001 From: John Bodley <4567245+john-bodley@users.noreply.github.com> Date: Wed, 8 Nov 2023 12:22:00 -0800 Subject: [PATCH] fix(table): Double percenting ad-hoc percentage metrics (#25857) --- .../plugins/plugin-chart-table/src/transformProps.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/superset-frontend/plugins/plugin-chart-table/src/transformProps.ts b/superset-frontend/plugins/plugin-chart-table/src/transformProps.ts index a4eb2e5e18a94..e76201cac30cb 100644 --- a/superset-frontend/plugins/plugin-chart-table/src/transformProps.ts +++ b/superset-frontend/plugins/plugin-chart-table/src/transformProps.ts @@ -118,9 +118,10 @@ const processColumns = memoizeOne(function processColumns( // because users can also add things like `MAX(str_col)` as a metric. const isMetric = metricsSet.has(key) && isNumeric(key, records); const isPercentMetric = percentMetricsSet.has(key); - const label = isPercentMetric - ? `%${verboseMap?.[key.replace('%', '')] || key}` - : verboseMap?.[key] || key; + const label = + isPercentMetric && verboseMap?.hasOwnProperty(key.replace('%', '')) + ? `%${verboseMap[key.replace('%', '')]}` + : verboseMap?.[key] || key; const isTime = dataType === GenericDataType.TEMPORAL; const isNumber = dataType === GenericDataType.NUMERIC; const savedFormat = columnFormats?.[key];