Creating calculated column
It seems to be some old limitation of the optimizer maybe, aliases to aggregating expressions are not allowed in more complex expressions in ORDER BY.

You can get around it by using the full expression instead of the alias:

ORDER BY
    COUNT(CASE WHEN vote &gt; 0 THEN vote ELSE NULL END)
  *
    AVG(CASE WHEN vote &gt; 0 THEN vote ELSE NULL END)