Pivot Table V2: Incorrect subtotals for non-additive metrics (%) #40965
-
|
### Superset Version: 6.0.0 I'm using Pivot Table V2 with:
Metrics:
Margin % is defined as a Custom SQL metric: Observations:
Example: 47.52% where I would expect: (870k + 1.1M) / (1.83M + 2.39M) I found:
Question: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi @pmilsomadaxa! I'm Dosu and I'm helping the Apache Superset team. No, correct subtotaling of non-additive metrics (ratios/percentages) does not work in Superset 6.0.0 — this is an unresolved architectural limitation that persists across all current versions. Root cause: Superset's backend post-processing receives pre-aggregated SQL results (your Margin % is already calculated per row) and then treats all numeric columns as additive when computing subtotals. It sums the displayed percentages rather than recalculating Status of the references you found:
There is no release containing a fix for this. The issue is tracked across multiple open tickets (#25747, #32260, #38674, #36165) and a maintainer has noted it's "not a pressing issue for committers from the Preset team, but we're happy to review solutions" [3]. Workarounds:
There are also broader proposals in flight — SIP-179 for per-metric aggregation customization and SIP-205 for an AntV S2-based pivot table — but neither has shipped yet. To reply, just mention @dosu. Docs are dead. Just use Dosu. |
Beta Was this translation helpful? Give feedback.

Hi @pmilsomadaxa! I'm Dosu and I'm helping the Apache Superset team.
No, correct subtotaling of non-additive metrics (ratios/percentages) does not work in Superset 6.0.0 — this is an unresolved architectural limitation that persists across all current versions.
Root cause: Superset's backend post-processing receives pre-aggregated SQL results (your Margin % is already calculated per row) and then treats all numeric columns as additive when computing subtotals. It sums the displayed percentages rather than recalculating
SUM(revenue_amt - calc_cogs_amt) / NULLIF(SUM(revenue_amt), 0)at the subtotal grouping level [1].Status of the references you found: