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

# Add custom utilization

> How to customize the utilization calculation in Atoti Limits by implementing the IUtilizationCalculator interface to override the default utilization measure creation and computation methods

You can customize the [Utilization](../../user-ref/cube/utilization) calculation by adding a bean that implements the `IUtilizationCalculator` interface. Here’s how to do this:

## 1. Create the Spring Bean

The `IUtilizationCalculator` contains two methods that need to be overridden:

```java theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
public interface IUtilizationCalculator {

    /**
     * @param copperContext
     *
     *  Creates the utilization measure in the Limits cube using copper
     */
    void createUtilizationMeasure(ICopperContext copperContext);

    /**
     * @param incident
     * @return the utilization value as per the evaluation
     */
    double computeUtilization(Incident incident);
```

The `createUtilizationMeasure` method is used to create the utilization measure in the Limits cube. The `computeUtilization` method is used to compute the
utilization
once a limit has been evaluated, and is visible in the Limits Status screen. The class `DefaultUtilizationMeasureCalculator` handles the default calculation.

If you want to implement your own utilization calculation, for instance $\dfrac{exposure}{limitValue}$, the custom Spring Bean will look as follows:

```java theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
@Component
public class MyUtilizationMeasureCalculator implements IUtilizationCalculator {

    @Override
    public void createUtilizationMeasure(ICopperContext copperContext) {
        Copper
                .measure(MEASURE_EXPOSURE)
                .divide(Copper.measure(MEASURE_LIMIT_VALUE))
                .per(Copper.level(DIM_TECHNICAL, HIER_INCIDENT_KEY, HIER_INCIDENT_KEY))
                .doNotAggregateAbove()
                .withName(MEASURE_UTILIZATION)
                .withFormatter(PERCENT_FORMAT)
                .publish(copperContext);
    }

    @Override
    public double computeUtilization(final Incident incident) {
        return incident.getMeasureValue() / incident.getLimitValue()[0];
    }
}
```

## 2. Import the Spring Bean

Once the bean is created, you need to [import it to the project](.#importing-spring-beans-into-the-project). Once done,
Spring will use the custom bean for calculating the utilization.
