sum
To return the total sum of a number array
With the function, you can calculate the mathematical sum of numeric values from an array or a table.
For example, the sum of invoice totals or the sum of a specific item sold across all stores.
In conjunction with the select
and where
filter conditions, you can, for example, determine the turnover of a specific item sold in a specific store in a specific year and prepare the result for display or further process.
You can use the function also on table views in columns with numeric values.
Syntax
sum([number])
Return
number
Examples
sum([1,2,3,4,5,6,7,8,9])
Result: 45
sum((select Invoices).Total)
Result: Sum value of all invoice totals in the Invoice table.
sum((select Invoices where year(Date) = 2021).Total)
Result: Total of all invoiced amounts in 2021.
Do you want to dive deeper into the topic? Take a look at the corresponding part of our video tutorial.