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
  • Loading branch information
diegomedina248 authored Mar 18, 2022
1 parent d41f9b2 commit 4f0074a
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 @@ -1842,7 +1842,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 4f0074a

Please sign in to comment.