I think you're right that you need the aggr function. Without it you get only one number back from avg(x). I don't know what should go in your buckets. It could be products or salesmen or months etc. Try starting with Key and see if that gives you the result you need.
=aggr(if( (Avg(x) - Avg(y)) / Avg(x) < -0.25, 'Bad',
if( (Avg(x) - Avg(y)) / Avg(x) > 0.25, 'Good', 'OK')
Selections in other fields will still influence which x and y values are used in the calculation..
Thanks for the quick response. Turns out that I wasn't thinking about the equation very Qlikview-y. Avg(x) is the average price of each product, so aggr(Avg([Price]),[Product]) returned the results I'm looking for.
Even though that returns the proper number, the chart still isn't what I need... It seems that my expression Count(Key) is placing the same number of instances within each bucket. In other words, the categories 'Good', 'Bad', and 'OK' all have 100 items in them, which is equal to the total population.
Is there a trick to dispersing these within each bucket? I assumed that just counting the total in the expression would split them by my category.