From 3c555d37c6b8966b5b79673d74081c6b6d7ac84b Mon Sep 17 00:00:00 2001 From: Ville Brofeldt Date: Mon, 26 Apr 2021 07:23:22 +0300 Subject: [PATCH] feat(filter-box): sort by metric on backend --- superset/viz.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/superset/viz.py b/superset/viz.py index 5bedc6b399f9c..05708035300e4 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -2069,6 +2069,9 @@ def run_extra_queries(self) -> None: qry["groupby"] = [col] metric = flt.get("metric") qry["metrics"] = [metric] if metric else [] + asc = flt.get("asc") + if metric and asc is not None: + qry["orderby"] = [(metric, asc)] QueryContext( datasource={"id": self.datasource.id, "type": self.datasource.type}, queries=[qry],