atoti.measures module#

class atoti.measures.Measures#

Manage the measures of a cube.

The built-in measure contributors.COUNT indicates how many rows from the cube’s base table took part in each aggregate of a query:

Example

>>> df = pd.DataFrame(
...     columns=["City", "Price"],
...     data=[
...         ("London", 240.0),
...         ("New York", 270.0),
...         ("Paris", 200.0),
...     ],
... )
>>> table = session.read_pandas(
...     df, keys=["City"], table_name="Built-in measures"
... )
>>> cube = session.create_cube(table)
>>> l, m = cube.levels, cube.measures
>>> cube.query(m["contributors.COUNT"])
  contributors.COUNT
0                  3
>>> cube.query(m["contributors.COUNT"], levels=[l["City"]])
         contributors.COUNT
City
London                    1
New York                  1
Paris                     1

The caption of this measure can be changed with an I18nConfig.