Defining variables in DAX queries
This article shows how to define variables in DAX queries and introduces the differences in scope when there are multiple EVALUATE statements.
If you read DAX queries generated by Power BI, you will probably notice that the variables are often defined in the DEFINE section rather than after an EVALUATE statement. In doing so, all the EVALUATE statements of the same batch execution can access the variables previously defined.
For example, the following code defines a variable SelectedColors used as a filter in two different EVALUATE statements.