atoti.array.sum()#

atoti.array.sum(value: VariableColumnConvertible, /) JavaFunctionOperation#
atoti.array.sum(value: VariableMeasureConvertible, /) MeasureDescription

Return a measure equal to the sum of all the elements of the passed array measure.

Example

>>> pnl_table = session.read_csv(
...     RESOURCES_PATH / "pnl.csv",
...     array_separator=";",
...     keys=["Continent", "Country"],
...     table_name="PnL",
... )
>>> cube = session.create_cube(pnl_table)
>>> l, m = cube.levels, cube.measures
>>> m["Sum"] = tt.array.sum(m["PnL.SUM"])
>>> m["Empty sum"] = tt.array.sum(m["PnL.SUM"][0:0])
>>> cube.query(m["PnL.SUM"], m["Sum"], m["Empty sum"])
                          PnL.SUM      Sum Empty sum
0  doubleVector[10]{-20.163, ...}  -308.29       .00