GitHub user pmilsomadaxa created a discussion: Pivot Table V2: Incorrect 
subtotals for non-additive metrics (%)

**### Superset Version: 6.0.0**

I'm using Pivot Table V2 with:
**Rows:**
* revgroupno
* revcategory

**Metrics:**
* Revenue
* Margin
* Margin %

Margin % is defined as a Custom SQL metric:
(SUM(revenue_amt) - SUM(calc_cogs_amt))/NULLIF(SUM(revenue_amt),0)* 100

**Observations:**

1. Row subtotals are working correctly once the values are configured as 
Metrics rather than Columns.
2. Revenue and Margin subtotals are correct.
3. Margin % detail rows are correct.
4. Margin % subtotal rows appear to be summing the displayed percentages rather 
than recalculating from the aggregated Revenue and Margin values.

Example:

47.52%
46.01%
Subtotal = 93.53%

where I would expect:

(870k + 1.1M) / (1.83M + 2.39M)
≈ 46.7%

I found:

* Issue #23560
* Issue #25747
* PR #34592 ("Correct totals for non-additive metrics")

**Question:**
Is correct subtotaling of non-additive metrics (ratios/percentages) expected to 
work in Superset 6.0.0?
If so, is there a configuration option or feature flag required?
If not, which release contains the fix for non-additive metric totals/subtotals?
<img width="1120" height="136" alt="image" 
src="https://github.com/user-attachments/assets/831fd00e-1ad2-47d0-9f88-5e0ed13d8763";
 />


GitHub link: https://github.com/apache/superset/discussions/40965

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to