Skip to content

Commit

Permalink
fix: custom SQL in Sort By Breaks Bar Chart (#19069)
Browse files Browse the repository at this point in the history
(cherry picked from commit 4f0074a)
  • Loading branch information
diegomedina248 authored and villebro committed Apr 3, 2022
1 parent fed1c24 commit f6346d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -1843,7 +1843,7 @@ def get_data(self, df: pd.DataFrame) -> VizData: # pylint: disable=too-many-loc
sortby = utils.get_metric_name(
self.form_data.get("timeseries_limit_metric") or metrics[0]
)
row = df.groupby(groupby).sum()[sortby].copy()
row = df.groupby(groupby)[sortby].sum().copy()
is_asc = not self.form_data.get("order_desc")
row.sort_values(ascending=is_asc, inplace=True)
pt = df.pivot_table(index=groupby, columns=columns, values=metrics)
Expand Down

0 comments on commit f6346d6

Please sign in to comment.