Jeet Kainth takes us through the process of working with variables in DAX:
Variables can simplify your DAX code, help with debugging and help improve performance. To use variables in your DAX measure you need to declare a variable using the VAR keyword, give the variable a name, and then assign an expression to the variable. You can use multiple variables in a measure but when using variables you must use a RETURN statement to specify the final output to be returned.
Read on for a demonstration, as well as several examples of how you can use variables to make your DAX-writing life easier.