Skip to content

Export to pivoted Excel exports percentage values with decimals as raw numbers #38557

@carlosaran667

Description

@carlosaran667

Bug description

I found another minor issue with "Export to Pivoted Excel" for pivot tables, this time related to percentage values that contain decimals.
Related to #38555

Steps to reproduce

  1. Create a Pivot Table chart.
  2. Use a metric that returns percentage values.
  3. Set the chart Value format to ,.2~%.
  4. Click Download -> Export to Pivoted Excel.
  5. Open the exported file in Excel.

Expected behavior

Percentage values should be exported consistently as numeric values already scaled for Excel percentage formatting.

For example:

  • 2% should be exported as 0,02
  • 43,66% should be exported as 0,4366

Actual behavior

Percentage values without decimals are converted correctly (2% becomes 0,02).
However, percentage values with decimals are exported as the raw number instead of being divided by 100.
For example:
43,66% becomes 43,66 instead of 0,4366

If the column type is then changed to Percentage in Excel, those values are multiplied by 100, which leads to inconsistent results within the same exported column.

Screenshots/recordings

Superset UI:
Image

Excel:
Image

Superset version

6.0.0

Python version

3.10

Node version

I don't know

Browser

Firefox

Additional context

The chart Value format is set to:
,.2~%

I am using the chart-level value format because setting a percentage D3 format in the dataset metric configuration does not to work in pivot tables.

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    viz:charts:pivotRelated to the Pivot Table charts

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions