Bug description
Bug description Problem 1: The percentage calculation in tables that use pagination is not based on the total number of rows, but only on the rows displayed on that page. This means that the percentage calculation is always incorrect.
Problem 2: Still related to the percentage calculation issue, Superset appears to be unable to correctly group the fields on which to calculate. If I use a graph to explain the information, I get a tooltip that's consistent with the expected results. If I report the data in tabular form, I get an incorrect calculation.
Chart and tooltip:
Result:
Table definition:
Screenshots/recordings
No response
Superset version
4.1.3
Python version
I don't know
Node version
I don't know
Browser
Chrome
Additional context
No response
Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [x] 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.
Comment From: dosubot[bot]
Hi @GiuGit7! I'm Dosu and I’m helping the superset team.
This is a known limitation in Superset tables: by default, percentage metrics in table visualizations are calculated only from the data on the current page (the "row_limit"), not from the entire dataset, which leads to incorrect percentages when pagination is enabled. To fix this, set the "Percentage metric calculation" option in the table chart controls to "All records"—this will make Superset calculate percentages based on the full dataset, even with pagination enabled. You can find this option in the table chart's control panel under "Percentage metric calculation" (choices: "row_limit" or "all_records") source.
Charts and tables use different aggregation logic: charts often aggregate over the entire dataset or group, so tooltips show correct percentages, while tables default to per-page calculations unless you change this setting source.
If you need more control (like percent-of-group within a table), you can define a custom SQL metric in your dataset to pre-calculate the percentage you want source.
There is also an open proposal (SIP-179) to allow more flexible aggregation per metric in tables, but as of 4.1.3, aggregation for totals/subtotals is uniform across all fields source.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
Comment From: rusackas
Closing in favor of https://github.com/apache/superset/issues/34425, which came first and seems identical to this issue.