I'm doing a comparative analysis which i've got working fine which uses the
sum({[ConditionB] * $} Amount)
in the expression. I have noticed though that if nothing is selected that is will sum everything rather than going to zero and having a flat or no line at all.
As I couldn't find an identifier here, the only option I could see was to change the import script and had the import do a sum(amount) * - 1 and tag that row onto the end.