sadpandajoe commented on code in PR #45306:
URL: https://github.com/apache/superset/pull/45306#discussion_r4353572675


##########
superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/utilities.ts:
##########
@@ -243,15 +252,28 @@ export default function buildGroupbyCombinations(
     formData.showValuesAs === ShowValuesAsEnum.PERCENT_OF_ROW ||
     formData.showValuesAs === ShowValuesAsEnum.PERCENT_OF_TOTAL;
 
+  // The collapsed level on the metric axis is the `[metric]` key, drawn as a
+  // per-metric Subtotal line. Not applicable when metrics are combined.
+  const metricsOnRows = formData.metricsLayout === MetricsLayoutEnum.ROWS;
+  const needsMetricRowSubtotal =
+    !formData.combineMetric && !!formData.rowSubTotals && metricsOnRows;
+  const needsMetricColSubtotal =
+    !formData.combineMetric && !!formData.colSubTotals && !metricsOnRows;
+
   const rowPrefixNeeded = (prefix: QueryFormColumn[]): boolean => {
     if (prefix.length === rows.length) return true; // leaf / full level
-    if (prefix.length === 0) return !!formData.colTotals || 
needsRowsCollapsed; // bottom Total row
+    if (prefix.length === 0)
+      return (
+        !!formData.colTotals || needsRowsCollapsed || needsMetricRowSubtotal

Review Comment:
   Fixed in 21013ae298: `_pivot_grouping_sets` now applies the same metric-axis 
subtotal rule as the plugin (the collapsed row level for `rowSubTotals` with 
metrics on rows, the collapsed column level for `colSubTotals` with metrics on 
columns, skipped when metrics are combined). 
`test_pivot_metric_axis_subtotal_levels` covers the plugin's territory/quarter 
cases, including transposed, opposite-toggle and combined-with-percent configs.
   



##########
superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/utilities.ts:
##########
@@ -243,15 +252,28 @@ export default function buildGroupbyCombinations(
     formData.showValuesAs === ShowValuesAsEnum.PERCENT_OF_ROW ||
     formData.showValuesAs === ShowValuesAsEnum.PERCENT_OF_TOTAL;
 
+  // The collapsed level on the metric axis is the `[metric]` key, drawn as a
+  // per-metric Subtotal line. Not applicable when metrics are combined.
+  const metricsOnRows = formData.metricsLayout === MetricsLayoutEnum.ROWS;
+  const needsMetricRowSubtotal =
+    !formData.combineMetric && !!formData.rowSubTotals && metricsOnRows;

Review Comment:
   Fixed in d9c6268a9c: `combineMetric` is no longer a `renderTrigger` control. 
Unchecking "Combine metrics" with `rowSubTotals` on now marks the chart as 
needing an update, and Run fetches the per-metric subtotal level. It is covered 
by the control test together with the other level-selecting options.
   



##########
superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/utilities.ts:
##########
@@ -229,15 +238,28 @@ export default function buildGroupbyCombinations(
     formData.showValuesAs === ShowValuesAsEnum.PERCENT_OF_ROW ||
     formData.showValuesAs === ShowValuesAsEnum.PERCENT_OF_TOTAL;
 
+  // The collapsed level on the metric axis is the `[metric]` key, drawn as a
+  // per-metric Subtotal line. Not applicable when metrics are combined.
+  const metricsOnRows = formData.metricsLayout === MetricsLayoutEnum.ROWS;
+  const needsMetricRowSubtotal =
+    !formData.combineMetric && !!formData.rowSubTotals && metricsOnRows;
+  const needsMetricColSubtotal =
+    !formData.combineMetric && !!formData.colSubTotals && !metricsOnRows;

Review Comment:
   Addressed: `metricsLayout` and `transposePivot` are no longer 
`renderTrigger` controls (20d2343acf), and neither is `combineMetric` 
(d9c6268a9c), so changing any of them marks the chart as needing an update and 
Run fetches the levels it needs. The control test covers all seven 
level-selecting controls.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to