VAR DAX Statement

The VAR keyword introduces variables in an expression.
The syntax after VAR defines a variable, which can be consumed in following VAR statements or within the mandatory RETURN statement following the declaration of one or more variables.
If VAR is used in the DEFINE section of an EVALUATE statement, it can be used in any expression of the statement and the RETURN keyword cannot be used.

VAR <name> = <expression>
[VAR <name2> = <expression2> [...]]
RETURN <result_expression>

The expression is evaluated only once and assigned to the name in the scope of the expression where the VAR/RETURN expression is used.
The expression2 has access to name.
The result_expression has access to all the variables (name, name2, …) defined in the VAR statement(s) before RETURN.

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.


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


This parameter is deprecated and its use is not recommended.


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