Built-in Functions → sum
sum() is an aggregation function that returns the sum of the values in a column.
Signature
sum(double[] exp)
double[] exp : expression evaluating to double
Returns
double
representing the sum of the values in the column.
Example
Consider the following table of example data:
Year Quarter Month Amount Sold2019 Q1 M1 1002019 Q1 M2 2002019 Q1 M3 1002019 Q2 M4 1502019 Q2 M5 2502019 Q2 M6 1502019 Q3 M7 2002019 Q3 M8 2502019 Q3 M9 3002019 Q4 M10 1002019 Q4 M11 502019 Q4 M12 502020 Q1 M1 1502020 Q1 M2 1002020 Q1 M3 2002020 Q2 M4 1502020 Q2 M5 1002020 Q2 M6 1502020 Q3 M7 502020 Q3 M8 1002020 Q3 M9 2002020 Q4 M10 1502020 Q4 M11 1002020 Q4 M12 50
Find the total amount sold (add up the values in the Amount Sold column).
sum(AMOUNT_SOLD)