Forum Discussion
webportal
Impactful Individual
10 years agoUsing a Boolean expression with CALCULATE
Can someone explain me why this expression of a calculated measure works: Measure = CALCULATE(SUM(Facts[Turnover]);FILTER('Facts';'Facts'[UnitPrice]>=50)) Whereas this one doesn't: Measu...
- 10 years agoThis is correct. No measure or CALCULATE expression, unless you write a full FILTER expression around it.
Anonymous
10 years agoNot applicable
In what sense does the second formula "not work"? It appears to work fine in my test.
webportal
Impactful Individual
10 years agoHello,
I get the error:
This means something like: "A CALCULATE function was used in a TRUE/FALSE expression as a table filter. This is not allowed".
And this message gets me even more confused.
However, the following function works perfectly:
- Anonymous10 years agoNot applicable
Are you adding that formula as a measure or a column?
- webportal10 years ago
Impactful Individual
As a measure.
- LaurentCouartou10 years ago
Solution Supplier
If 'Facts'[UnitPrice] is a calculated column, this expression
Measure = CALCULATE(SUM(Facts[Turnover])
;'Facts'[UnitPrice]>=50
)is just a shortcut for:
Measure = CALCULATE(SUM(Facts[Turnover])
;FILTER( ALL('Facts'[UnitPrice])
;'Facts'[UnitPrice]>=50
)
)If 'Facts'[UnitPrice] is a measure, however, you will get an error message about CALCULATE not being allowed in a filter expression expression (of a CALCULATE expression).
Is it what is happening here?