Forum Discussion
Anonymous
4 years agoNot applicable
Calculate function does not apply filter from visual in row context
Hi
I have a simple DAX to calculate row by row transaction as follow.
Overdue Balance = calculate(sumx(DTransactions,DTransactions[TransactionAmount] - DTransactions[AllocatedAmount]),DTransactions[StatementNumber] <> 0)
just simply I need to sumx TransactionAmount - AllocateAmount which statementNumber is not equal to 0.
But I get the total value of the sum for each statement number. Why visual filter didn't apply here?
However, If I put the filter function, it will give the correct result.
Overdue Balance 2 = sumx(FILTER(DTransactions,DTransactions[StatementNumber] <> 0),DTransactions[TransactionAmount] - DTransactions[AllocatedAmount])
DebtorTansaction is the fact table. Overdue3 is a test for the ALL function with Filter (It is the correct value).
Thanks
2 Replies
- amitchandakSuper User
Anonymous , refer if this causing issue in your case
http://dataap.org/blog/2019/04/22/difference-between-calculate-with-and-without-filter-expression/
- AnonymousNot applicable
Hi amitchandak,
Thanks for the reply. I totally understand your link explanation.
I tried to understand why calculate function didn't take the Statement number as an incoming filter. I think what happens is I said to get all transactions statement number is not equal to 0. So, the calculate function does sumx (row context) as everything one set. it cannot transfer the context again as statementnumber is not a valid incoming filter.
Regards