dosubot[bot] commented on issue #37627: URL: https://github.com/apache/superset/issues/37627#issuecomment-3839749024
<!-- Greeting --> Hi @alesconti! I'm [Dosu](https://go.dosu.dev/dosubot) and Iām helping the superset team. <!-- Answer --> This is a known limitation in Superset tables: percentage metrics often show zeros or incorrect values in the summary row because Superset aggregates percentages as regular numbers, rather than recalculating them based on the underlying data. This happens especially when the "show summary" option is enabled, since the summary row just sums the percentages instead of computing the correct aggregate percentage. There isn't a configuration option to change this behavior in Superset 6.0.0 [[source](https://github.com/apache/superset/issues/34350)]. To improve percentage accuracy in your table, set the "Percentage metric calculation" option in the Table chart controls to "All records" instead of the default "Row limit". This makes Superset calculate percentages based on the full dataset, which helps avoid zeros and incorrect values (note: this may impact performance on large datasets) [[source](https://github.com/apache/superset/issues/34425)]. For correct summary row values, define a custom metric in your dataset using SQL that calculates the percentage at the aggregation level you need (for example, `SUM(numerator) / SUM(denominator)`), so the summary row reflects the correct value [[source](https://github.com/apache/superset/issues/34350)]. If you see zeros due to formatting, try increasing decimal precision in the column format or multiplying the value in SQL before formatting. If your metric references a Decimal datatype, casting it to Double Precision can also help avoid zero or division errors [[source](https://github.com/apache/superset/issues/28170)]. Sometimes, re-creating the percentage metric column from scratch resolves configuration issues that cause formatting problems [[source](https://github.com/apache/superset/issues/36189)]. If you have error logs or see unexpected behavior beyond these known limitations, feel free to share more details. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/8ec117ef-882a-4282-b447-1fc41ae1ca6d?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/8ec117ef-882a-4282-b447-1fc41ae1ca6d?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/8ec117ef-882a-4282-b447-1fc41ae1ca6d?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/8ec117ef-882a-4282-b447-1fc41ae1ca6d?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/8ec117ef-882a-4282-b447-1fc41ae1ca6d?feedback_type=hallucination) | [Report š](https://app.dosu.dev/response-feedback/8ec117ef-882a-4282-b447-1fc41ae1ca6d?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/8ec117ef-882a-4282-b447-1fc41ae1ca6d?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=This%20is%20a%20known%20limitation%20in%20Superset%20tables%3A%20percentage%20metrics%20often%20show%20zeros%20or%20incorrect%20values%20in%20the%20summary%20row%20because%20Superset%20aggregates%20percentages%20as%20regular%20numbers%2C%20rather%20than%20recalculating%20them%20based%20on%20the%20underlying%20data.%20This%20happens%20especially%20when%20the%20%22show%20summary%22%20option%20is%20enabled%2C%20since%20the%20summary%20row%20just%20sums%20the%20percentages%20instead%20of%20computing%20the%20correct%20aggregate%20percentage.%20There%20isn%27t%20a%20configuration%20option%20to%20change%20this%20behavior%20in%20Superset%206.0.0%20%5B%5Bsource%5D%28https%3A//github.com/apache/superset/issues/34350%29%5D.%0A%0ATo%20improve%20percentage%20ac curacy%20in%20your%20table%2C%20set%20the%20%22Percentage%20metric%20calculation%22%20option%20in%20the%20Table%20chart%20controls%20to%20%22All%20records%22%20instead%20of%20the%20default%20%22Row%20limit%22.%20This%20makes%20Superset%20calculate%20percentages%20based%20on%20the%20full%20dataset%2C%20which%20helps%20avoid%20zeros%20and%20incorrect%20values%20%28note%3A%20this%20may%20impact%20performance%20on%20large%20datasets%29%20%5B%5Bsource%5D%28https%3A//github.com/apache/superset/issues/34425%29%5D.%0A%0AFor%20correct%20summary%20row%20values%2C%20define%20a%20custom%20metric%20in%20your%20dataset%20using%20SQL%20that%20calculates%20the%20percentage%20at%20the%20aggregation%20level%20you%20need%20%28for%20example%2C%20%60SUM%28numerator%29%20/%20SUM%28denominator%29%60%29%2C%20so%20the%20summary%20row%20reflects%20the%20correct%20value%20%5B%5Bsource%5D%28https%3A//github.com/apache/superset/issues/34350%29%5D.%0A%0AIf%20you%20see%20zeros%20due%20to%20formatting%2C%20try%20i ncreasing%20decimal%20precision%20in%20the%20column%20format%20or%20multiplying%20the%20value%20in%20SQL%20before%20formatting.%20If%20your%20metric%20references%20a%20Decimal%20datatype%2C%20casting%20it%20to%20Double%20Precision%20can%20also%20help%20avoid%20zero%20or%20division%20errors%20%5B%5Bsource%5D%28https%3A//github.com/apache/superset/issues/28170%29%5D.%0A%0ASometimes%2C%20re-creating%20the%20percentage%20metric%20column%20from%20scratch%20resolves%20configuration%20issues%20that%20cause%20formatting%20problems%20%5B%5Bsource%5D%28https%3A//github.com/apache/superset/issues/36189%29%5D.%0A%0AIf%20you%20have%20error%20logs%20or%20see%20unexpected%20behavior%20beyond%20these%20known%20limitations%2C%20feel%20free%20to%20share%20more%20details.) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet? text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/37627) -- 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]
