Variables were first introduced into the DAX language with Power BI in 2015 and with the 2016 versions of Excel and SSAS Tabular.
Variables allow you to store hard coded values or the results that are returned by a DAX expression. They can store both scalar values and tables and can be used within the definitions of calculated columns, measures, and tables.
A variable is declared using the VAR keyword, and the overall process of declaring and using a variable uses the following syntax:
VAR <variableName> = <DAX expression>
RETURN <DAX expression including variableName>
When defining an expression, you can use as many variables as you need; each variable is declared using its own VAR keyword. Variables can be used for declaration purposes when defining other variables, as well as to return values in the expression given after...