March 2018
Beginner to intermediate
514 pages
13h 11m
English
Variables can be used anywhere, including in expressions. Variables can hold an entire expression, but they can also contain parts of it.
To use a variable that contains part of an expression, simply use the dollar-sign expansion within the expression. Say you had the following variable created in the script:
LET vCurrentYear = year(today());SET vMySalesField = '[Sales]';
You could create a chart that calculates sales for the current year using the variable vCurrentYear:
sum(if([Year] = $(vCurrentYear), $(vMySalesField))
This expression returns the sales for the current year.
Read now
Unlock full access