GitHub user dosubot[bot] added a comment to the discussion: pivot table sorting
<!-- Answer --> This is a recognized limitation with pivot table sorting in Superset, particularly when you have multi-level (grouped) rows/columns. Here's what's happening and some potential workarounds: **The Issue:** The pivot table sorting configuration (`rowOrder`/`colOrder`) is stored in the chart's form data and *should* persist [[1]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/controlPanel.tsx#L310-L362). However, there are known bugs with value-based sorting on multi-level pivot tables — specifically, sorting gets "messed up" when applied to grouped rows/columns. There are open PRs ([#38080](https://github.com/apache/superset/pull/38080), [#35322](https://github.com/apache/superset/pull/35322)) attempting to fix this, but they remain unmerged. Additionally, the interactive column sorting feature (clicking column headers to sort) was merged in [PR #36050](https://github.com/apache/superset/pull/36050), which may give you better results than the static sort controls. **Workarounds to try:** 1. **Use interactive column sorting** — click the column header directly in the pivot table to sort by that column. This was added relatively recently and may persist better than the form-level toggle. 2. **Pre-sort in your SQL** — If your custom SQL metrics allow it, you can use `ORDER BY` in your query/dataset to influence the default row order before the pivot is applied. 3. **Use Row Order / Column Order controls** — In the chart's Customize tab, explicitly set "Row Order" or "Column Order" to `value_a_to_z` or `value_z_to_a`. Make sure you save the chart after setting these, then re-add it to the dashboard. 4. **Simplify grouping temporarily** — If sorting works with a single-level pivot but breaks with two/three levels, that confirms you're hitting the grouped sorting bug. In that case, you may need to wait for the fix PRs to be merged, or restructure your visualization (e.g., using a regular Table chart with grouping instead of a Pivot Table). Unfortunately, there's no perfect workaround for the multi-level sorting bug right now since the fixes are still pending review. If the interactive column header sorting (option 1) doesn't persist for you either, this is likely the same underlying issue. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).* --- Share context across your team and agents. Try [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-tagline&utm_term=apache%2Fsuperset). [](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-feedback&utm_term=apache%2Fsuperset&message_id=fc3bc2a8-8fd6-4a19-bbe9-e4cf7aae7002) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-learn-repo&utm_term=apache%2Fsuperset) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-add-team&utm_term=apache%2Fsuperset) GitHub link: https://github.com/apache/superset/discussions/40788#discussioncomment-17188702 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
