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

# Adding new kpis

> Guide to adding new KPIs in Atoti FRTB by defining Spring beans with the required cube qualifier format

This page provides a description of how to add a KPI.

The techniques employed are generic examples that can be extended, adapted and repeated for any use
case required. In all cases, minimal changes are made to the Reference Implementation.

A KPI can be defined as a bean with a Qualifier in the following format `kpi[cubeNameHERE]`. Below is an example of a KPI on the FRTBCombinedCube

Be sure to include the configuration class which contains the bean(s) in the application config class `FRTBConfig` located
in `/frtb-starter/src/main/java/com/activeviam/frtb/starter/cfg/impl/`

```java theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
    @Bean
    @Qualifier("kpiFRTBCombinedCube")
    public IKpiDescription myKpiTest() {
        return StartBuilding.kpi()
            .withName("myName")
            .withValue(new KpiValueDescription("[Measures].[MyMeasure]"))
            .withStatus(new KpiStatusDescription(
                "Case\n" +
                "When IsNull(KpiValue(\"MyMeasure\"))\n" +
                "Then NUll\n" +
                "When 0.7 > KpiValue(\"MyMeasure\")\n" +
                "Then -1\n" +
                "When KpiValue(\"MyMeasure\") > 0.8\n" +
                "Then 1\n" +
                "Else 0\n" +
                "End",
                "Shapes"))
            .build();
    }
```

Pre-defined KPIs are located in the class `KpiProviderConfig` within `/frtb-starter/src/main/java/com/activeviam/frtb/starter/cfg/impl/`
