Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pivot table cannot validly group rows and keep ordering #20564

Open
comdiv opened this issue Jun 30, 2022 · 5 comments
Open

Pivot table cannot validly group rows and keep ordering #20564

comdiv opened this issue Jun 30, 2022 · 5 comments
Labels
#bug Bug report

Comments

@comdiv
Copy link

comdiv commented Jun 30, 2022

While we have only one row ordering field but can add multiple row dimensions it's assumed that when we
set order by value decending it will be work same way as with order by a-z:

  1. first row as group is ordered by a-z
  2. then second row inside group ordering by a-z

But if you choose order by value - it's breaking all groupping - all group rows occures multiple times in pivot!

Hard to explain how to exactly reproduce it.

Just compre two variances of ordering a-z and by value

image

As you can see - it cause valid behavior - group ordering then subgroup ordering

But try to set another option

image

It breaks table! Group is splitting and Subtotals not counted as expected!!!!

@comdiv comdiv added the #bug Bug report label Jun 30, 2022
@comdiv
Copy link
Author

comdiv commented Jul 1, 2022

superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/utilities.js:694

  case 'value_a_to_z':
          this.rowKeys.sort((a, b) => naturalSort(v(a, []), v(b, [])));
          break;
        case 'value_z_to_a':
          this.rowKeys.sort((a, b) => -naturalSort(v(a, []), v(b, [])));
          break;

doesn't reqalculate subtotals so cannot sort them correctly

comdiv added a commit to spectrum-data/superset that referenced this issue Jul 1, 2022
@comdiv
Copy link
Author

comdiv commented Jul 1, 2022

Have fix it for own usage, but may be it could be incorporated in main repository
#20588

all known issues with sort fixed

comdiv added a commit to spectrum-data/superset that referenced this issue Jul 5, 2022
@rusackas
Copy link
Member

rusackas commented Feb 8, 2024

Just to drop a note here, I'm trying to get an ephemeral environment up to test the PR. Hopefully we can get this merged, but more pivot table expertise would be nice for testing.

@rusackas
Copy link
Member

rusackas commented Jun 3, 2024

Assuming this is still an issue in current Superset? I'm trying again to spin up a test environment, but hoping @kgabryje can help test/review as well.

@JZ6
Copy link
Contributor

JZ6 commented Jul 8, 2024

yes it is still an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
#bug Bug report
Projects
None yet
Development

No branches or pull requests

3 participants