superset: Sort by is not working for Pivot Table and Pivot Table V2 chart

Sort by is not working for Pivot Table and Pivot Table V2 chart.

How to reproduce the bug

  1. Create a [Pivot Table] or [Pivot Table V2] chart;
  2. Add some fields in Row section and one metric in the Metrics section;
  3. Try to sort the data using the metric.

Expected results

When SORT DESCENDING is selected, the data in the pivot table should be in descending. It is possible to see in the images below that the sorting is respected in the Results section, but in the pivot table nothing happens.

Actual results

  • Pivot Table image

  • Pivot Table V2 image

Environment

  • browser type and version: Chrome (Version 110.0.5481.177)
  • superset version: superset version 2.0.1
  • any feature flags active:
    • ENABLE_TEMPLATE_PROCESSING
    • DASHBOARD_RBAC

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven’t found one similar.

Additional context

  • Helm Chart;

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 16
  • Comments: 25 (2 by maintainers)

Most upvoted comments

I’m seeing the same issue in Preset version 2024.8.2. The query that runs is correct, but the pivot table sorts in ascending order for this example:

SELECT DATE_TRUNC('month', order_date) AS order_date,
       state AS state,
       COUNT(*) AS count
FROM public."Vehicle Sales"
GROUP BY DATE_TRUNC('month', order_date),
         state
ORDER BY 1 DESC
LIMIT 10000

This is still broken in 4.1.1. Please Please Please create a way for us to sort values in a pivot table by a column of our choosing. This is basic usage of a pivot table to be able to sort by different columns. Many people have a specific order they need to see the data, and only being able to sort alphabetically or numerically by the first column in a pivot table is a non-starter.

same here 😦 , please fix because it makes the table not usable for the user to quickly look at a lot of data

@rusackas The issue remains the same: sorting in pivot tables doesn’t work, as it displays data in a random order.

I’m using Superset 4.1.1 and cannot sort by another column or metric. Do you have any update on this problem? @rusackas

Same here! Any known workaround?

We too have encountered the exact same issue!

image

Same problem here 😦