Forum Discussion
Anonymous
7 years agoNot applicable
Bug when using Calculate with variables
Hey, everyone. I'm having a problem with Calculate and Variables. This is the data I generated for the Proof of Concept I'm trying to obtain the sum of amount in each ca...
- 7 years ago
Anonymous -
I might have chosen a different method that you may find useful based off of what you've shown:
Measure = IF ( ISFILTERED ( Planiha1[Client] ), SUM ( Planiha1[Amount] ), CALCULATE ( SUM ( Planiha1[Amount] ), ALLEXCEPT ( Planiha1, Planiha1[Category] ) ) )
mattbrice
7 years agoSolution Sage
The problem is that variables are evaluated in the context they are initialized, not when they are used. In your example "amount" was already computed before it was used in your calculate function, so it returned the total of the "'Planilha1 (2)'[Amount]" column. ok?