aminghadersohi commented on code in PR #45306:
URL: https://github.com/apache/superset/pull/45306#discussion_r4331776452
##########
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:
`combineMetric` now decides this level too, but it stays `renderTrigger:
true` (controlPanel.tsx:283, outside this diff so no suggestion). Unchecking
"Combine metrics" with rowSubTotals on re-renders without a requery, leaving
the per-metric Subtotal line with no rows.
##########
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:
The declared Python mirror of this builder, `_pivot_grouping_sets` in
superset/common/form_data_query_context.py, still implements the pre-change
rule, so MCP chart tools and the XLSX export fallback keep the leaf-derived
subtotal while the chart shows the DB rollup.
--
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]