> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# sum_product()

> @overload\
>
> atoti.agg.sum\_product(\
>
>     *\*factors*: [Column](./atoti.Column#atoti.Column),\
>
> ) → MeasureDefinition

> @overload\
>
> atoti.agg.sum\_product(\
>
>     *\*factors*: MeasureConvertible,\
>
>     *scope*: [CumulativeScope](https://docs.activeviam.com/engine/python-sdk/6.2/api/atoti.scope.CumulativeScope.md#atoti.CumulativeScope) | [SiblingsScope](https://docs.activeviam.com/engine/python-sdk/6.2/api/atoti.scope.SiblingsScope.md#atoti.SiblingsScope) | [OriginScope](https://docs.activeviam.com/engine/python-sdk/6.2/api/atoti.scope.OriginScope.md#atoti.OriginScope),\
>
> ) → MeasureDefinition

Return a measure equal to the sum product aggregation of the passed factors across the specified scope.

### Parameters

#### *\*factors*

The factors to multiply together and then aggregate as a sum.

#### *scope*

The [`aggregation scope`](./atoti.scope#module-atoti.scope).

***

```pycon theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
>>> from datetime import date
>>> df = pd.DataFrame(
...     columns=["Date", "Category", "Price", "Quantity", "Array"],
...     data=[
...         (date(2020, 1, 1), "TV", 300.0, 5, [10.0, 15.0]),
...         (date(2020, 1, 2), "TV", 200.0, 1, [5.0, 15.0]),
...         (date(2020, 1, 1), "Computer", 900.0, 2, [2.0, 3.0]),
...         (date(2020, 1, 2), "Computer", 800.0, 3, [10.0, 20.0]),
...         (date(2020, 1, 1), "TV", 500.0, 2, [3.0, 10.0]),
...     ],
... )
>>> table = session.read_pandas(
...     df,
...     table_name="Date",
... )
>>> table.head().sort_values(["Category", "Date"]).reset_index(drop=True)
        Date  Category  Price  Quantity         Array
0 2020-01-01  Computer  900.0         2    [2.0, 3.0]
1 2020-01-02  Computer  800.0         3  [10.0, 20.0]
2 2020-01-01        TV  300.0         5  [10.0, 15.0]
3 2020-01-01        TV  500.0         2   [3.0, 10.0]
4 2020-01-02        TV  200.0         1   [5.0, 15.0]
>>> cube = session.create_cube(table)
>>> h, l, m = cube.hierarchies, cube.levels, cube.measures
>>> m["turnover"] = tt.agg.sum_product(table["Price"], table["Quantity"])
>>> cube.query(m["turnover"], levels=[l["Category"]])
          turnover
Category
Computer  4,200.00
TV        2,700.00
>>> m["array sum product"] = tt.agg.sum_product(table["Price"], table["Array"])
>>> cube.query(m["array sum product"])
               array sum product
0  doubleVector[2]{15300.0, ...}
```
