SET

Syntax for SET:

SET( variable names, values, expression)

How to use the SET function

The SET function defines the variables named in the first parameter (entered as text: "variable") with the values in the second parameter. The third parameter uses the named and defined variable (entered as a variable: $variable) to perform the specified formula.

Example:

SET("unixdates",
Join(DATE(@A:A, "yyyy-MM-dd")),
Groupby(Select(@B:B, Between(Array($unixdates), $startdate, $enddate)), Select(@C:C, Between(Array($unixdates),$startdate, $enddate))))

  • The first part of the formula names the variable "unixdates".
  • JOIN and DATE are used to define the variable, unixdates, to a column of dates converted to Unix format.
  • The variable, $unixdates, is used in the GROUPBY expression to include the dates it is defined with and align them with dates in column B and column C that fall BETWEEN the $startdate and $enddate variables. 

SET and dynamic data sources

SET can also be used with dynamic data sources to set the values for the variables used in the dynamic data source. 

The data source in this example is using dynamic properties: startdate and enddate. The values are being set to 7daysago and yesterday.

Example:

SET(Array("startdate, enddate"), Array("7daysAgo", "yesterday"), @A:A)

Learn More: