Variables can be defined within DAX measures and primarily serve to improve the readability of DAX expressions. Rather than creating and referencing separate DAX measures, variables provide an inline option, thereby limiting the volume of distinct measures in a dataset. As a basic example of variable syntax, the "Last Refreshed" text message described in the Parameter Tables section of Chapter 8, Connecting to Sources and Transforming Data with M, uses a DAX variable in its expression, as follows:
Last Refresh Msg = VAR CurrentDateValue = MAX('CurrentDate'[CurrentDate]) RETURN "Last Refreshed: " & CurrentDateValue
The VAR function is used to name a variable and the RETURN keyword allows for the variable's result to be referenced ...