SUM
Last updated
Was this helpful?
Last updated
Was this helpful?
Calculates the sum across the months specified for a metric or a variable.
Syntax: SUM (
metric_or_variable
,
start_index
,
end_index
)
metric_or_variable
is the name of the metric or variable
start_index
is the starting index which can be described either in fixed or relative terms to the time period
end_index
is the ending index which can be described either in fixed or relative terms to the time period
For example, consider the Customers
metric for the period of Jan '23 to Jul '23
For the time period defined above, an index 0
refers to Jan '23 whose value is 10
, index 1
refers to Feb '23 whose value is 20
, and so on. The index can take on negative values as well—these would refer to previous time periods—for example, index -1
would refer to the value in Dec '22. Assume the values for Oct '22, Nov '22 and Dec '22 to be 10 each.
The sum is computed by adding all the values specified between the starting and ending indices as shown in the examples below:
Example to calculate sum: SUM ( Customers , 0 , 2 )
( 10 + 20 + 30 ) = 60
Output: 60
(for all cells)
Example to calculate sum: SUM ( Customers , t-1 , t-2 )
Output: Jan '23: 20; Feb '23: 20; Mar '23: 30; Apr '23: 50; May '23: 70; Jun '23: 90; Jul '23: 110