Skip to content

Pivot Table Grand Total sums percentages instead of re-calculating the metric (Server-side aggregation failed) #38674

@mudeshankarnaik

Description

@mudeshankarnaik

Bug description

I am using Apache Superset to build a DataMart with 200+ metrics. When using the Pivot Table, the Grand Total row is performing a simple SUM() of the rows in the frontend (Javascript) instead of re-calculating the metric using the provided SQL expression. This results in incorrect "Partial Sums" for ratios (e.g., $10% + 20% = 30%$ instead of the correct weighted average).

How to Reproduce
Create a metric: SUM(numerator) / NULLIF(SUM(denominator), 0).

Add this metric to a Pivot Table.

Enable "Show Totals".

Observe that the Total row sums the individual row percentages.

Expected Behavior
The Total row should re-execute the metric's SQL formula against the total context (Total Numerator / Total Denominator), similar to how "Partial Sums" work in tools like Qlik.

Actual Behavior
The total is a simple summation of the values displayed in the table rows.

Environment
Superset version: 5.0.0 (or your specific version)

Database: ClickHouse

Feature Flags enabled: ENABLE_BACKEND_PIVOT_TOTALS, GENERIC_CHART_AXES

Screenshots/recordings

No response

Superset version

5.0.0

Python version

3.9

Node version

16

Browser

Chrome

Additional context

I have confirmed that ENABLE_BACKEND_PIVOT_TOTALS = True is set in superset_config.py, but the legacy Pivot Table plugin does not appear to respect this flag.

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    validation:requiredA committer should validate the issueviz:charts:pivotRelated to the Pivot Table charts

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions