sadpandajoe commented on code in PR #44679:
URL: https://github.com/apache/superset/pull/44679#discussion_r4308992585


##########
superset/charts/client_processing.py:
##########
@@ -752,6 +944,31 @@ def collapse(block: pd.DataFrame) -> tuple[pd.DataFrame, 
str]:
             else None,
         )
 
+    if independent_summaries:

Review Comment:
   When `aggregateFunction` is unset or `Metric`, this filter still runs for 
the currency-context pass (`independent_summaries` includes 
`CURRENCY_CONTEXT_AGGREGATION`), but the main pass only filters subtotals under 
result aggregation. With `rowSubTotals: false`, `colTotals: true`, AUTO 
currency, and rows `region`/`city` (region A is USD 10 + 20, another region 
EUR), the main frame keeps the `(A, Subtotal)` row = 30 while the currency 
frame drops it, so `reindex` finds no context and it exports as `30.00` instead 
of `$ 30.00`. On master both passes insert the same labels. Should this filter 
apply only when `result_aggregation` is set, or should the main pass drop the 
same subtotals?



##########
docs/docs/using-superset/pivot-result-exports.md:
##########
@@ -0,0 +1,64 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# Pivot result aggregation exports
+
+Pivot Table result aggregation summarizes the grouped metric values returned by
+the chart query. For example, with grouped values 1, 9, 20 and 100, a saved
+**Median** aggregation produces a grand summary of 14.5. It does not calculate 
the median
+of intermediate subtotals. Query filters and row limits apply before this step.
+
+## Saved aggregation settings
+
+The chart control panel exposes **Show values as**, but does not expose a
+result-aggregation selector. This export behavior applies to charts whose saved
+configuration already contains an `aggregateFunction`, for example from a
+version with an aggregation selector. This page does not describe a new control
+available in the chart editor.
+
+A missing, unrecognized or **Metric** setting keeps metric-definition behavior.
+Saved settings such as **Sum**, **Average** and **Median** apply a second
+aggregation to the returned grouped results.
+
+Row and column subtotals can be enabled independently of grand totals. A shared
+total combining different metrics is blank because those metrics do not have a
+single meaningful aggregate. This also applies when metrics are placed on rows
+or the table is transposed.
+
+## Fractions and formatting
+
+**Sum as Fraction of Total**, **Rows** or **Columns**, and the corresponding
+**Count** choices, use only their own metric in the denominator. Result
+aggregation takes precedence over the separate **Show values as** setting.
+Without a saved result aggregation, that setting applies to database-computed
+metric values.
+
+Formatted results display fractions as percentages, including when a metric has
+a currency override. CSV exports retain raw numeric ratios. Excel fractions
+remain numeric cells with a percentage number format, so they can be used in
+formulas. Other formatted results retain their configured formats; AUTO 
currency formatting uses the currencies of the

Review Comment:
   This says AUTO currency uses the contributing records of each cell or 
subtotal, but `Count` and its fraction variants skip that context 
(`PIVOT_AGGREGATIONS_WITHOUT_CURRENCY_CONTEXT`) and use the query-wide detected 
currency. An analyst exporting a saved Count chart over USD and EUR groups 
would expect local symbols, while 
`test_pivot_table_v2_count_auto_currency_uses_detected_fallback` asserts the 
fallback currency for both. Could the page note the Count exception?



-- 
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]

Reply via email to