Skip to content

sum_y() | sum_x()

Calculate the sum from a two-dimensional statistical aggregate for the dimension specified

Since 1.3.0

Calculate the sum from a two-dimensional statistical aggregate for the given dimension. For example, sum_y() calculates the skewness for all the values of the y variable, independent of values of the x variable.

Calculate the sum of the numbers from 0 to 100:

SELECT sum_y(stats_agg(data, data))
FROM generate_series(0, 100) data;
sum_y
-----
5050

The syntax is:

sum_y(
summary StatsSummary2D
) RETURNS DOUBLE PRECISION
sum_x(
summary StatsSummary2D
) RETURNS DOUBLE PRECISION
NameTypeDefaultRequiredDescription
summaryStatsSummary2D-The statistical aggregate produced by a stats_agg call
ColumnTypeDescription
sumDOUBLE PRECISIONThe sum of the values in the statistical aggregate