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

Apache Superset Pivot table cannot validly group rows and keep ordering

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

But try to set another option

Apache Superset Pivot table cannot validly group rows and keep ordering

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

Comment From: comdiv

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

Comment From: comdiv

Have fix it for own usage, but may be it could be incorporated in main repository https://github.com/apache/superset/pull/20588

all known issues with sort fixed

Comment From: rusackas

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.

Comment From: rusackas

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.

Comment From: JZ6

yes it is still an issue

Comment From: rusackas

Probably still an issue, but we're open to updated context and/or a PR if anyone is interested.

Comment From: rusackas

This hasn't really been touched in quite some time. We're still open to volunteers, but this may be closed in time as "not planned" to inactivity.

Comment From: rusackas

Closing this one in favor of https://github.com/apache/superset/issues/23353