- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using 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:
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In what sense does the second formula "not work"? It appears to work fine in my test.
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you adding that formula as a measure or a column?
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As a measure.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, 'Facts'[UnitPrice] is a measure.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Then you have your answer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, so the answer is I can't use a calculated measure in CALCULATE but I can use in FILTER function, correct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
03-19-2024 06:50 PM | |||
07-12-2024 04:55 AM | |||
07-10-2024 09:24 AM | |||
06-10-2024 12:22 PM | |||
07-29-2024 03:00 PM |
User | Count |
---|---|
13 | |
12 | |
10 | |
10 | |
9 |
User | Count |
---|---|
29 | |
16 | |
14 | |
13 | |
13 |