- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

# Using a Boolean expression with CALCULATE

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-31-2016 11:02 AM

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.

Accepted Solutions

## Re: Using a Boolean expression with CALCULATE

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-04-2016 10:03 AM

All Replies

## Re: Using a Boolean expression with CALCULATE

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-03-2016 12:56 PM

In what sense does the second formula "not work"? It appears to work fine in my test.

## Re: Using a Boolean expression with CALCULATE

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-03-2016 02:20 PM

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:

## Re: Using a Boolean expression with CALCULATE

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-03-2016 04:27 PM

Are you adding that formula as a measure or a column?

## Re: Using a Boolean expression with CALCULATE

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-04-2016 02:03 AM

As a measure.

## Re: Using a Boolean expression with CALCULATE

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-04-2016 02:31 AM

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?

## Re: Using a Boolean expression with CALCULATE

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-04-2016 02:36 AM

Yes, 'Facts'[UnitPrice] is a measure.

## Re: Using a Boolean expression with CALCULATE

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-04-2016 03:33 AM

Then you have your answer.

## Re: Using a Boolean expression with CALCULATE

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-04-2016 07:27 AM

Ok, so the answer is I can't use a calculated measure in CALCULATE but I can use in FILTER function, correct?

## Re: Using a Boolean expression with CALCULATE

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-04-2016 10:03 AM