Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Sign up nowGet Fabric certified for FREE! Don't miss your chance! Learn more
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:
Measure = CALCULATE(SUM(Facts[Turnover]);'Facts'[UnitPrice]>=50)
I know CALCULATE can use a Boolean expression or a table expression that defines a filter, but isn't the second expression using a Bolean condition:
'Facts'[UnitPrice]>=50
Solved! Go to Solution.
In what sense does the second formula "not work"? It appears to work fine in my test.
Hello,
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:
Are you adding that formula as a measure or a column?
As a measure.
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?
Yes, 'Facts'[UnitPrice] is a measure.
Then you have your answer. ![]()
Ok, so the answer is I can't use a calculated measure in CALCULATE but I can use in FILTER function, correct?
For a calculated column, you have the row context active, so row by row you can use the boolen expression. For the measure, there would be no row context active as it would be expected by the boolean expression.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 13 | |
| 9 | |
| 8 | |
| 5 | |
| 5 |