GROUPACCUMULATE

Syntax

GROUPACCUMULATE(<number or date>;<number>)

Description

Returns the sum of all previous records in a group.

This function requires a key column (GROUPBY) and two arguments. The first argument (OrderBy) is the column used for sorting the accumulated values. The second argument (number) is the column of values to be summed within their groups.

This is a group series function and only operates on columns from a data source or join sheet.

Example

Given the following data:

Date

Revenue
Jan 1, 201130
Feb 1, 201110
Mar 1, 201120
Apr 1, 201140
May 1, 201120
Jun 1, 201140
Jul 1, 201120
Aug 1, 201120
Sep 1, 201130
Oct 1, 201150
Nov 1, 201110
Dec 1, 201120
Jan 1, 201210
Feb 1, 201220
Mar 1, 201260
Jan 1, 201340
Feb 1, 201310
Mar 1, 201310

First create a group by the year using GROUPBY(YEAR(#RawData!Date))

Group_Year
2011
2012
2013

Next copy the date column to your group using COPY(#RawData!Date)

Group_YearDate
2011Jan 1, 2011
2011Feb 1, 2011
2011Mar 1, 2011
2011Apr 1, 2011
2011May 1, 2011
2011Jun 1, 2011
2011Jul 1, 2011
2011Aug 1, 2011
2011Sep 1, 2011
2011Oct 1, 2011
2011Nov 1, 2011
2011Dec 1, 2011
2012Jan 1, 2012
2012Feb 1, 2012
2012Mar 1, 2012
2013Jan 1, 2013
2013Feb 1, 2013
2013Mar 1, 2013

Using GROUPACCUMULATE(#RawData!Date;#RawData!Revenue), Datameer returns the accumulated sum of all the records within each group.

Group_YearDateGROUPACCUMULATE returns
2011Jan 1, 201130
2011Feb 1, 201140
2011Mar 1, 201160
2011Apr 1, 2011100
2011May 1, 2011120
2011Jun 1, 2011160
2011Jul 1, 2011180
2011Aug 1, 2011200
2011Sep 1, 2011230
2011Oct 1, 2011280
2011Nov 1, 2011290
2011Dec 1, 2011310
2012Jan 1, 201210
2012Feb 1, 201230
2012Mar 1, 201290
2013Jan 1, 201340
2013Feb 1, 201350
2013Mar 1, 201360