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

# I don't understand the restrictions of the CALCULATE (DAX).

[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-29-2018 08:36 AM - edited 10-29-2018 08:40 AM

Hello, community members.

I have been studying DAX function. ( URL : https://msdn.microsoft.com/query-bi/dax/calculate-function-dax)

There was something over an hour I couldn't understand.

There's nothing wrong right now, but I'm really curious about what that means.

-----------------------------------------------------------------------------------------------------------------------------------------

The following restrictions apply to Boolean expressions that are used as arguments:

The expression cannot reference a measure.

The expression cannot use a nested CALCULATE function.

The expression cannot use any function that scans a table or returns a table, including aggregation functions.

-------------------------------------------------------------------------------------------------------------------------------------------

Could anyone please give me examples or explanations?

Solved! Go to Solution.

Accepted Solutions

## Re: I don't understand the restrictions of the CALCULATE (DAX).

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

10-29-2018 09:31 AM

this reference is much more extensive

https://www.sqlbi.com/articles/context-transition-and-filters-in-calculate/

regarding the boolean expression specifically (this is where the limitations are valid) e.g. check if color is red

CORRECT CALCULATE(SUM(Table[Value]),Table[Color] = "Red") CALCULATE(SUM(Table[Value]),LOWER(Table[Color]) = "red") NOT CORRECT Flag1 = IF(Table[Color] = "Red", TRUE,FALSE) CALCULATE(SUM(Table[Value]),[Flag])

nested CALCUALTE is quite self explanatory, function that scans a table - my guess would be e.g. SUMX, FILTER (though I'm not sure about them)

please remember that instead of a boolean expression you can also pass a list of values - e.g. result of FILTER, DATESYTD, etc.

All Replies

## Re: I don't understand the restrictions of the CALCULATE (DAX).

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

10-29-2018 09:31 AM

this reference is much more extensive

https://www.sqlbi.com/articles/context-transition-and-filters-in-calculate/

regarding the boolean expression specifically (this is where the limitations are valid) e.g. check if color is red

CORRECT CALCULATE(SUM(Table[Value]),Table[Color] = "Red") CALCULATE(SUM(Table[Value]),LOWER(Table[Color]) = "red") NOT CORRECT Flag1 = IF(Table[Color] = "Red", TRUE,FALSE) CALCULATE(SUM(Table[Value]),[Flag])

nested CALCUALTE is quite self explanatory, function that scans a table - my guess would be e.g. SUMX, FILTER (though I'm not sure about them)

please remember that instead of a boolean expression you can also pass a list of values - e.g. result of FILTER, DATESYTD, etc.