CopperMeasure objects.
There are two approaches:
- Copper API for simple measures
- Measure factories for parameterized or reusable patterns
Prerequisites
Before creating measures, make sure:- A cube is created (see configure cubes)
- Copper API basics for measure definitions are understood
How to add a measure
The starting point for creating measures is theIMeasuresConfigurator interface from the cube configurator.
There are two main approaches:
IMeasuresConfigurator.addMeasure(String, CopperMeasure)- Add a measure defined with Copper APIIMeasuresConfigurator.addMeasure(String, IMeasureFactoryInput, IMetadataConfigurer)- Add a measure using a factory
How to add a measure with Copper
Create measures directly with the Copper API for simple calculations:The measure name is provided as the first argument of
addMeasure; the methods copperMeasure.as("name") and copperMeasure.withName("name") are not supported.
Intermediate measures that depend on each other must each be added separately via addMeasure.How to use measure factories?
For complex scenarios, use a measure factory. This approach is useful when:- Measure creation requires parameterization
- The Python API needs to modify elements used to create the measure
How to register a custom measure factory
Measure factories can be registered in two ways. Static registration uses the@AtotiPluginValue annotation. The factory is discovered by the Registry:
MeasureFactoryRegistration beans. Use this approach when the factory needs access to external objects, such as Spring-managed beans:
@AtotiPluginValue annotation when using dynamic registration. Multiple factories can be registered in a single MeasureFactoryRegistration bean.
How to create aggregated measures
UseCopperNext to define aggregated measures and user-defined aggregation functions (UDAFs).
CopperNext is a temporary class to expose API related to Copper and the Atoti Configuration API. This class will be merged into Copper once the Atoti Configuration API is no longer experimental.FieldPath relative to a table:
CopperNext:
avg- Average aggregationmin- Minimum aggregationmax- Maximum aggregationagg- Custom aggregation functions
How to create a UDAF
UseCopperNext.userDefinedAgg for user-defined aggregation functions:
How to rename measures
Predefined cubes may include measures that can be renamed. Add ‘name overrides’ in the application configuration file:Measure1 to MeasureA and Measure with spaces to MeasureB.
Use square brackets for measure names containing spaces.
Related pages
- Create dimensions and hierarchies: dimension configuration
- Speed up queries: aggregate providers and the measure cache