EVALUATE DAX Statement


EVALUATE is a DAX statement that is needed to execute a query. EVALUATE followed by any table expression returns the result of the table expression. Moreover, one or more EVALUATE statements can be preceded by special definitions like local tables, columns, measures and variables that have the scope of the entire batch of EVALUATE statements executed together.

-- Definition section
[DEFINE {  MEASURE <tableName>[<name>] = <expression> } 
        {  VAR <name> = <expression>}]
-- Query expression
EVALUATE <table>  
-- Result modifiers
[ORDER BY {<expression> [{ASC | DESC}]}[, …]  
[START AT {<value>|<parameter>} [, …]]]  

An EVALUATE statement is divided in three parts:

  • Definition section: introduced by the DEFINE keyword, it includes the definition of local entities like tables, columns, variables and measures. There can be a single definition section for one or more queries.
  • Query expression: introduced by the EVALUATE keyword, it contains the table expression to evaluate and return as the result. There might be multiple query expressions, each introduced by EVALUATE and each with its own set of result modifiers.
  • Result modifiers: an optional additional section to EVALUATE, which is introduced by the keyword ORDER BY. It includes the sort order of the result and the optional definition of which rows to return, by providing a starting point with START AT.

The first and the third part of the statement are optional. Thus, one can just use EVALUATE followed by any table expression to produce a query.

Here is an example of a query:

DEFINE
    VAR MinimumAmount = 2000000
    VAR MaximumAmount = 8000000
EVALUATE
FILTER (
    ADDCOLUMNS (
        SUMMARIZE ( Sales, 'Product'[Category] ),
        "CategoryAmount", [Sales Amount]
    ),
    AND ( 
        [CategoryAmount] >= MinimumAmount,
        [CategoryAmount] <= MaximumAmount
    )
)
ORDER BY [CategoryAmount]

Last update: Sep 12, 2018   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

DAX Conventions
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.

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.

Deprecated

This parameter is deprecated and its use is not recommended.

Contribute

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