Cumulative Calculated Columns
Summary
- Cumulative Calculated Columns perform cumulative aggregations
- The aggregation operation is applied to each row cumulatively in a specific, given order
Calculated Columns are able to display Cumulative Expressions.
These are an advanced form of Aggregation Expression.
They are similar in that the values derive from multiple rows but with one fundamental difference: they perform cumulative aggregations.
This means that the aggregation operation (e.g., SUM, MIN, MAX) is applied to each row cumulatively in a specific, given order.
Hint
This is particularly useful, for example, when we want to calculate a Running Total of a column
Find Out More
With the Server-Side Row Model, evaluate Cumulative Calculated Columns on the server — see Server-Side Row Model - Calculated Columns.
Developer Guide
Defining a Cumulative Calculated Column
There are 5 properties that you need to provide when defining a Cumulative Calculated Column:
CalculatedColumn: {
CalculatedColumns: [
{
ColumnId: 'cumulated-stars-count',
FriendlyName: 'Cumulated Stars Count',
Expression: 'SUM{[github_stars], CUMULATIVE([created_at])}',
CalculatedColumnSettings: {
DataType: 'number',
Filterable: true,
},
},
{
ColumnId: 'max-tech-debt-over-stars',
FriendlyName: 'Maximum Technical Debt',
Expression: 'MAX{[open_issues_count], CUMULATIVE([github_stars])}',
CalculatedColumnSettings: {
DataType: 'number',
Sortable: true,
},
},
],
},This ColumnId value is used to reference the Column in AdapTable State and in other objects (e.g. Layouts).
This value is used to refer to the Column in AdapTable UI.
It only needs to be provided if the ColumnId value is unsuitable.
This is a Cumulative Expression evaluated by AdapTableQL cumulatively across the grid in a specified order.
It is the Expression string of the Calculated Column and uses an aggregation (SUM, MIN, MAX, etc.) with a CUMULATIVE clause that sets the ordering.
The Data Type of the Calculated Column should be provided in CalculatedColumnSettings.
It is a Cell Data Type value and the object's only mandatory property. Common values are number, text or date.
Additional Settings for the Calculated Column (other than mandatory DataType) can be provided, including:
FilterablePivotableSortableGroupable
Add 2 Cumulative Calculated Columns to the current Layout: (a) "Running Notional" which will show a running total of the Notional column, with rows ordered by Trade Date (b) "Peak PnL So Far" which will show the maximum PnL seen so far when rows are ordered by Trade Date
- This demo contains 2 Calculated Columns that use Cumulative Aggregation Scalar Expressions:
Cumulated Stars Count- displays the cumulative sum of stars count of all repos in the grid, aggregated over theCreateddateMaximum Technical Debt- shows the cumulative maxima of open issues of all repos in the grid, aggregated over theGitHub Starscount
- The Calculated Columns are formatted using Column Formatting.