CALCULATETABLE DAX Function (Filter)  Context Transition

Evaluates a table expression in a context modified by filters.

Syntax

CALCULATETABLE ( <Table> [, <Filter> [, <Filter> [, … ] ] ] )
Parameter Attributes Description
Table

The table expression to be evaluated.

Filter Optional
Repeatable

A boolean (True/False) expression or a table expression that defines a filter.

Return values

Table An entire table or a table with one or more columns.

The value is the result of the expression evaluated in a modified filter context.

Remarks

Every filter argument can be either a filter removal (such as ALL, ALLEXCEPT, ALLNOBLANKROW), a filter restore (ALLSELECTED), or a table expression returning a list of values for one or more columns or for an entire expanded table.

When a filter argument has the form of a predicate with a single column reference, the expression is embedded into a FILTER expression that filters all the values of the referenced column. For example, the predicate shown in the first expression is internally converted in the second expression.

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

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

A filter argument overrides the existing corresponding filters over the same column(s), unless it is embedded within KEEPFILTERS.

CALCULATETABLE follow the same steps of CALCULATE to evaluate its result.

» 6 related articles
» 1 related function

Examples

CALCULATETABLE is identical to CALCULATE, except for the result: it returns a table instead of a scalar value.

-- Returns the colors of Proseware branded products
EVALUATE
CALCULATETABLE (
    VALUES ( 'Product'[Color] ),
    'Product'[Brand] = "Proseware"
)
Color
Silver
Blue
White
Red
Black
Green
Grey

Related articles

Learn more about CALCULATETABLE in the following articles:

Related functions

Other related functions are:

Last update: Mar 13, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://docs.microsoft.com/en-us/dax/calculatetable-function-dax

2018-2024 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of CALCULATETABLE? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.