Adding a Measure

This page provides a description of how we can add a measure. It features an example in which we use a new ‘TestNumber’ field as a measure. For a walk through on how to added a field to an existing data store please see the documentation HERE. The techniques employed are generic examples that can be extended, adapted and repeated for any use case that we need. In all cases, we make minimal changes to the Reference Implementation.

To add a field as a measure we need to make two modifications to the OlapModelConfig class inside /cvarc-starter/src/main/java/com/activeviam/cvarc/starter/cfg/impl/

Step 1 - Modifying Manager Description

In the managerDescription() method we want to append the managerDesc by adding the following lines above the return statement for the method.

Prerequisite information: To learn more about navigating the managerDesc please CLICK HERE.

            AggregatedMeasureDescription testNumber = new AggregatedMeasureDescription("TestNumber Measure", "TestNumber", "SUM"); // we can construct a measure with ("Measure's Name", "FieldName, "Aggregation")

//      Alternatively we can create a new AggregatedMeasure with no attributes and set them using the helper methods provided as shown below
//          AggregatedMeasureDescription testNumber = new AggregatedMeasureDescription();
//          testNumber.setFolder("Technical");
//          testNumber.setName("TestNumber Measure");                                      
//          testNumber.setFieldName("TestNumber");
//          testNumber.setPreProcessedAggregation("SUM");



            return managerDesc;

Step 2 - Modifying Schema

Modify our Cube’s schema so that the Field can be found and set to be a measure, in this case our modifications will be made in the createSASchemaSelectionDescription() method.

.withField("TestNumber", SAStoreNames.SA_BASE_TO_VEGA_REF+"/TestNumber")       // here we describe the path from the base store to the field we wish to expose as a measure