LET expression

LET expressions are used at the beginning of a formula to provide it with local variables. By defining your LET expressions at the beginning of your formula, you can reference them as many times as needed within the local scope of the formula. LET functions much like the variable declarations available in other languages.

NOTE   LET expressions cannot be updated or reassigned in a formula.

Examples

Your variable declaration can be very simple assignments. The following example creates a variable called Regions and assignes it a value of 42.

Copy
LET [Regions]=42

Your LET statement can also call upon data elements to assign values. The following example assigns the results of the Sales–Cost calculation to a variable named Margin.

Copy
LET [Margin]=[Sales]–[Cost]

After including these expressions at the beginning of your formula, you can now call Regions and Margin later in the formula.