I want to perform something like this:
ORDER BY {{sort_by}} {{sort_direction}}
Where I would be able to type in the variable like email, amount, name, etc. that I want to sort the data by and I could also type out either ASC or DESC as well in the field. Is that doable, since again, the simple text field doesnt do the very simple trick here
2 Likes
Hi @tautvydas.valatka
That is currently not possible. Would require this PR (or something similar) gets merged:
https://github.com/metabase/metabase/pull/5247
1 Like
Just found this question googling for a solution.
Inded it does'nt work directly, but It works with a CASE WHEN statement in order by.
[[order by
case
when {{sort_by}}='evo' then evo
when {{sort_by}}='ca_last' then ca_last
else ca
end
desc]]
1 Like