The example in the docsting is misleading. You should not use sortperm in such situations as it does not make much sense IMHO. Instead use e.g. ordinalrank from StatsBase.jl or just negation in your case (as your column is continuous):
using StatsBase
@chain msleep begin
@select :name :order :sleep_total
@orderby begin
:order
ordinalrank(:sleep_total, rev=true)
end
end
@chain msleep begin
@select :name :order :sleep_total
@orderby :order -:sleep_total
end