sumsq()

Table of Contents

Definition

sumsq() returns the sum of squared of the values in the selected table column. You can use it with the transform commands that support aggregations.

Examples

The following example returns the sum of squared price column and groups the result by a year.

%dpl
index=sales_inventory earliest="01/01/2017:00:00:00"
| rex4j field=_raw "price=(?<price>\d+)"
| eval year=strftime(_time, "%Y")
| stats sumsq(price) by year
example of sumsq() aggregation command

Further Reading