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

# Replacing cube measures

This page provides a description of how some measures can be replaced to modify the calculation logic.

The measures at the beginning of the calculation chain are now defined using Spring beans. These definitions are designed to be overridden.

For example, this can be used to calculate the SES capital requirement according to the
EBA's [RTS on the capitalisation of non-modellable risk factors](https://www.eba.europa.eu/regulation-and-policy/market-risk/regulatory-technical-standards-capitalisation-non-modellable-risk-factors-under-ftrb)
. This could be done with the following steps:

1. Customize the input files, datastore, and IMA cube schema to add the additional fields required by these calculations.
2. Replace the "ES (SES)" measure with a measure that applies the EBA's formulas using the additional fields.<br />The Solution will continue with the IMA ES calculations using this new custom measure.

To replace the "ES (SES)" measure, note that the default implementation is defined in `IMAMeasureBeans` with the following method signature and annotations:

```java theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
@Qualifier(NMRF_CAPITAL_REQUIREMENT)
@CoreIMAMeasure
public CopperMeasure nmrfCapitalRequirement(){
	...
}
```

This measure can be replaced in any Spring configuration class by adding a bean with a different name, using the `@IMAMeasure`
annotation with the same qualifier. If the class you are using is new, be sure to include it in `FRTBConfig` imports. For example,

```java theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
@Qualifier(NMRF_CAPITAL_REQUIREMENT)
@IMAMeasure
public CopperMeasure nmrfCapitalRequirementEBA(){
	...
}
```

<Note>
  The difference between the `@CoreIMAMeasure` and `@IMAMeasure` annotations is that the latter includes `@Primary`.

  The `CopperMeasure` objects returned by these methods should not be published to the copper context by these methods.
</Note>

This new measure definition can include custom logic and make use of custom measures and levels in the cube. The Solution's IMA ES calculations will use the
measure defined by this bean as the underlying measure.

## Suggested further reading

[Adding New Cube Hierarchies](./add-a-new-cube-hierarchy)

[Adding and Loading New Columns to an Existing File](../etl/add-and-load-new-column-to-existing-file)
