Cannot order visualization by median or percentile

Hi,

I want to create a horizontal bar chart, which shows a percentile or median value, grouped by terms.
How can I order by the metric I've set? Longest bars should be on top. Median or percentile are greyed out, so I cannot select this ordering. Any workarounds available? Why can't it be done?

I'm on version 7.4.2.

Thanks,
Andreas

If you select the custom metric, can you create one to sort by?

No, I already tried:
image

there is no percentile available.