Hi @azhukova,
You have to move your ifelse inside the sum. Take a look at the mismatched aggregation section at the bottom of this article: