How does the CALCULATETABLE function (DAX) work?

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


     <expression>, <filter1>, <filter2>,…

How do you use the CALCULATETABLE function?

The CALCULATETABLE function changes the context in which data is filtered, and evaluates the expression in the new context.  

For each column used in a filter argument, any existing filters are removed, and the filter used in the filter argument will be used instead. 

Related Blog Posts


Considerations when using the CALCULATETABLE function

The first parameter must be a function that returns a table. There are also restrictions applied to arguments that are Boolean expressions: the expression cannot reference a measure, it cannot be used as a nested CALCULATE function nor it can be used in any function that scans or returns a table, such as aggregation functions. 

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

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


Related Course Modules