> ## 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.

# min_member()

<span id="atoti.agg.min_member" />

> atoti.agg.min\_member(<br />
>     *measure*: VariableMeasureConvertible,<br />
>     /,<br />
>     *level*: [Level](./atoti.Level#atoti.Level),<br />
> ) → MeasureDefinition

Return a measure equal to the member minimizing the passed measure on the given level.

When multiple members minimize the passed measure, the first one
(according to the order of the given level) is returned.

### Parameters

<h4 id="atoti.agg.min_member.measure">
  *measure*
</h4>

The measure to minimize.

<h4 id="atoti.agg.min_member.level">
  *level*
</h4>

The level on which the minimizing member is searched for.

***

```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
>>> df = pd.DataFrame(
...     columns=["Continent", "City", "Price"],
...     data=[
...         ("Europe", "Paris", 200.0),
...         ("Europe", "Berlin", 150.0),
...         ("Europe", "London", 240.0),
...         ("North America", "New York", 270.0),
...     ],
... )
>>> table = session.read_pandas(
...     df,
...     table_name="City price table",
... )
>>> table.head()
       Continent      City  Price
0         Europe     Paris  200.0
1         Europe    Berlin  150.0
2         Europe    London  240.0
3  North America  New York  270.0
>>> cube = session.create_cube(table, mode="manual")
>>> h, l, m = cube.hierarchies, cube.levels, cube.measures
>>> h["Geography"] = [table["Continent"], table["City"]]
>>> m["Price"] = tt.agg.single_value(table["Price"])
    >>> m["City with minimum price"] = tt.agg.min_member(m["Price"], l["City"])
```

> At the given level, the measure is equal to the current member of the City level:

> ```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
> >>> cube.query(m["City with minimum price"], levels=[l["City"]])
>                        City with minimum price
> Continent     City
> Europe        Berlin                    Berlin
>               London                    London
>               Paris                      Paris
> North America New York                New York
> ```

> At a level above it, the measure is equal to the city of each continent with the minimum price:

> ```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
> >>> cube.query(m["City with minimum price"], levels=[l["Continent"]])
>               City with minimum price
> Continent
> Europe                         Berlin
> North America                New York
> ```

> At the top level, the measure is equal to the city with the minimum price across all continents:

> ```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
> >>> cube.query(m["City with minimum price"])
>   City with minimum price
> 0                  Berlin
> ```
