Getting an Aggregate Amount using Sum

  • Updated

This article goes over the sum function. The sum function allows us to sum up one or more numerical variables within a collection.

Syntax

{collection | sum:'variableOne'}

You can also include math within the sum function.

{collection | sum:'variableOne*variableTwo'}

Example

Sample Data

Transactions:

  1. numShares = 2 @ pricePerShare = 10

  2. numShares = 5 @ pricePerShare = 20

Code

Meaning

Result

{transaction | sum:'numShares'}

All shares issued

7

{transaction | sum:'numShares*pricePerShare'}

Aggregate consideration received

120