Query.jl: how to filter on derived quantities of a group?

I am having a hard time trying to figure out how to filter by a derived quantity of a group using either the standalone or linq syntax. For example, I might want to group by some column then select only rows in that group with a second column having values larger than the group mean. Very much a split/apply/combine-y thing but can;t figure out if there is syntax to support.

Can you provide some test data, MWE, and expected results?

Well I don’t know how to provide a MWE in the linq style… that is what I am confused about. But with just DataFrames one example might be:

data = DataFrame(x = [:a,:a,:a,:a,:b,:b,:b,:c,:c], y = 1:9, z = 11:19)
groupcond(g) = g .> mean(g)
result = by(data, :x, rows-> rows[groupcond(rows[:y]),[n for n in names(rows) if n != :x]])
@test result == DataFrame(x = [:a,:a,:b,:c],y=[3,4,7,9],z = [13,14,17,19])

I think a more elegant way of doing it with base DataFrames would be

by(data, :x) do d
    d[d.y .> mean(d.y), :]
end

or

 by(data, :x) do d
    m = mean(d.y)
    filter(x -> x.y > m, d)
end