msyavuz opened a new pull request, #43718:
URL: https://github.com/apache/superset/pull/43718

   ### SUMMARY
   
   A pivot table set to "Show values as" % of row/column/total showed 
percentages on screen but raw values in pivoted CSV/XLSX downloads and 
scheduled reports.
   
   Those paths render server-side via `apply_client_processing` → 
`charts/client_processing.py::pivot_table_v2`, which reproduces the client 
pivot but only knew the pre-SIP-216 `"... as Fraction of ..."` aggregate 
functions. `showValuesAs` was already in the request form data and silently 
dropped — this reads it.
   
   Mirrors the client's `fractionOf`:
   - Applied **after** totals, so a "% of row" grand total row reads 
`columnTotal / grandTotal` instead of summing the fractions above it, and each 
subtotal divides by its own rollup.
   - Denominators stay within one metric (handles `combineMetric` and the ROWS 
metrics layout); cross-metric totals divide by the all-metric denominator.
   - Zero denominator → NaN, matching `pandas_postprocessing.pivot`.
   - JSON output (report email tables) forces `,.3%` and drops currency, as the 
client ignores custom formatters for a ratio. CSV/XLSX keep raw fractions — 
that path never applies number formats to any metric.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — no UI change; only server-rendered export/report output.
   
   ### TESTING INSTRUCTIONS
   
   1. Pivot table chart, "Show values as" = % of Total, Row totals on.
   2. Download → **Export to Pivoted .CSV** (the plain "Export to .CSV" is the 
raw un-pivoted export and is unchanged). Cells are fractions of the grand 
total; the Total column reads `1`.
   3. Schedule a report on the same chart with format XLSX or CSV → attachment 
matches. Format TEXT → emailed table shows `12.500%`.
   
   Verified end-to-end through a scheduled XLSX report.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: Fixes #42809
   - [ ] Required feature flags: none
   - [ ] Changes UI: no — backend-only
   - [ ] Includes DB Migration: no
   - [ ] Introduces new feature or API: no — existing form-data field now 
honored server-side
   - [ ] Removes existing feature or API: no


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