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

# plugin_measure()

> atoti.plugin\_measure(\
>
>     *\*args*: NestedPluginMeasureArgs,\
>
>     *plugin\_key*: [str](https://docs.python.org/3/builtins/stdtypes.html#str),\
>
> ) → MeasureDefinition

Return a measure computed by a plugin registered by an [Atoti Server extension](https://docs.activeviam.com/engine/java-sdk/6.2/starters/how-to/create-custom-measures.md).

> [!WARNING]
>
> This feature is [`experimental`](./atoti.experimental#atoti.experimental), its key is `"plugin_measure"`.

### Parameters

#### *\*args*

The arguments forwarded to the measure plugin.
Supported types include:

* Scalar (any non-array [`data type`](./atoti.type#module-atoti.type))
* [`Column`](./atoti.Column#atoti.Column)
* [`Hierarchy`](./atoti.Hierarchy#atoti.Hierarchy)
* [`Level`](./atoti.Level#atoti.Level)
* Any [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict), [`list`](https://docs.python.org/3/builtins/stdtypes.html#list) or [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) of the above types.

#### *plugin\_key*

The key of the measure plugin.

***

```pycon theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
>>> session_config = tt.SessionConfig(extra_jars=[server_extension_jar_path])
>>> session = tt.Session.start(session_config)  
```

```pycon theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
>>> df = pd.DataFrame(
...     [("Phone", 2), ("Watch", 4), ("Laptop", 1)],
...     columns=["Product", "Quantity"],
... )
>>> table = session.read_pandas(
...     df,
...     keys={"Product"},
...     table_name="Example",
... )
>>> cube = session.create_cube(table)
>>> l, m = cube.levels, cube.measures
```

The Atoti Server extension provided by `server_extension_jar_path` contributes a measure plugin with the key `"MY_INCREMENT"`:

```pycon theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
>>> with tt.experimental({"plugin_measure"}):
...     m["Incremented quantity.SUM"] = tt.plugin_measure(
...         m["Quantity.SUM"].name, l["Product"], 2, plugin_key="MY_INCREMENT"
...     )
>>> cube.query(
...     m["Quantity.SUM"],
...     m["Incremented quantity.SUM"],
...     levels=[l["Product"]],
... )
        Quantity.SUM Incremented quantity.SUM
Product
Laptop             1                        3
Phone              2                        4
Watch              4                        6
```
