Need a function that returns values above or below a threshold

Unlike the top/bottom selectors that return a set number of values, it would be extremely useful if we could have a function or pair of functions that returned all values that are, say higher than 80, or below something…
I know this can be done using WHERE value > 80 … But the problem is for cases when we need values passed onto other functions, using WHERE constraints discards values out of range.

So, an example of using this type of function might be ; finding out the % sum of all values > 80 of the whole

ex. SELECT sum(above(value,80)) / sum(value) * 100 FROM …

I’m sure there isn’t a way to do this, but if there is, let me know?


This would be a perfect use case for a Flux query. If you’re not already trying out Flux, sign up for the Flux Office Hours that happen every Tuesday/Thursday and come ask that question there!

Best Regards,