CALCULATETABLE Function (DAX)

How does the CALCULATETABLE function (DAX) work?

The CALCULATETABLE function (DAX) evaluates a table expression in a context modified by the given filters.

CALCULATETABLE Formula Syntax

CALCULATETABLE(
     <expression>, <filter1>, <filter2>,…
)

How do you use the CALCULATETABLE function?

The expression used as the first parameter must be a function that returns a table.

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.

However, a Boolean expression can use any function that looks up a single value, or that calculates a scalar value.

Related Blog Posts

Related Support Forum Posts

Need Help with DAXquery using nested IF statement/Switch
Problem With SUMX With IF
Median Of A Time Column

Considerations when using the CALCULATETABLE function

The CALCULATETABLE function changes the context in which the data is filtered, and evaluates the expression in the new context that you specify. For each column used in a filter argument, any existing filters on that column are removed, and the filter used in the filter argument is applied instead.

This function is a synonym for the RELATEDTABLE function.

Related Video Tutorials

Formula examples using the CALCULATETABLE function

=SUMX( CALCULATETABLE(‘InternetSales_USD’, ‘DateTime'[CalendarYear]=2006) , [SalesAmount_USD])

CALCULATETABLE(<table_expression>, table[column]=10)

= SUMX ( CALCULATETABLE (East_Sales, FILTER (East_Sales, East_Sales[Product]=[Product])), East_Sales[Sales Amount] )

Related DAX Functions

FILTER Function (DAX)

Related Course Modules

Ultimate-Beginners-Guide-To-PowerBI

DOWNLOAD

To access our comprehensive DAX formula reference guide just insert your email address below. The resource will download immediately and we’ll also email it to you.