Getting an Aggregate Amount using Sum

Doc Auto Team
Doc Auto Team
  • 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

{transactions | sum:'numShares'}

All shares issued

7

{transactions | sum:'numShares*pricePerShare'}

Aggregate consideration received

120