This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/superset.git

commit eea6a8ed4fb9a5ad9103ce4a6df7a6ed313eabe1
Author: John Bodley <[email protected]>
AuthorDate: Wed Nov 8 12:22:00 2023 -0800

    fix(table): Double percenting ad-hoc percentage metrics (#25857)
    
    (cherry picked from commit 784a478268fd89e6e58077e99bb2010987d6b07c)
---
 superset-frontend/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 3c9c00d3c1..0c8970737d 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];

Reply via email to