sum

Returns the sum of the values in a column.

Examples

Consider the following table of example data:

Year    Quarter    Month    Amount Sold    Amount Sold Per Quarter

2019    Q1         M1       100             400
2019    Q1         M2       200             400
2019    Q1         M3       100             400
2019    Q2         M4       150             550
2019    Q2         M5       250             550
2019    Q2         M6       150             550
2019    Q3         M7       200             750
2019    Q3         M8       250             750
2019    Q3         M9       300             750
2019    Q4         M10      100             200
2019    Q4         M11      50              200
2019    Q4         M12      50              200

Find the total amount sold (add up the values in the Amount Sold column).

sum(Sales_Acme.Sales.AMOUNT_SOLD)

Find the total amount sold for each quarter for each year.

SUM(Amount Sold, group by (Year, Quarter))

Syntax

sum(double expr, [groupBy(...)])
  • expr : expression evaluating to double
  • groupBy : optional grouping function

    Returns

    double representing the sum of the values in the column. If groupBy is used, sum returns the sum for each group.

Notes

You must include all the leading grouping dimensions in the Insight from the top-down to the level-based measure you want to evaluate. See Aggregation with Level Based Measure in Aggregating Functions.


© Incorta, Inc. All Rights Reserved.