Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version next

...

You can substitute a placeholder value for the column name, which is useful if you are applying the same function across multiple columns. For example:

D code

set col:score1,score2 value:IF ($col == 0, AVERAGE($col), $col)

Output: In the above transform, the values in score1 and score2 are set to the average of the column value when the value in the column is 0. Note that the computation of average is applied across all rows in the column, instead of just the filtered rows.

...

You can use window functions in your set transforms:

D code

set col: avgSales value: ROLLINGAVERAGE(POS_Sales, 7, 0) group: saleDate order: saleDate

Output: Calculate the value in the column of avgSales to be the rolling average of the POS_Sales values for the preceding seven days, grouped and ordered by the saleDate column. For more information, see Window Functions.

D s
snippetParameters

D code

set col:col1,[col2] value:(expression) [group: group_col] 

TokenRequired?Data TypeDescription
setYtransformName of the transform
col1YstringColumn name
col2NstringColumn name
valueYstringExpression that generates the value to store in the column
groupNstringIf you are using aggregate or window functions, you can specify a group expression to identify the subset of records to apply the value expression.

...