You cannot do this directly, because the indexing model does not support complex expressions. You will need to add a new property that you manually maintain, like the difference between the purchase and sale prices, and then look for elements where this delta property is greater or less than zero.
source
share