// Get the root MdmSchema.
MdmSchema rootSchema = getMdmMetadataProvider().getRootSchema();
// Get the MdmMeasureDimension of the root MdmSchema, and the Source for it.
MdmMeasureDimension mdmMeasDim = rootSchema.getMeasureDimension();
StringSource measDim = (StringSource) mdmMeasDim.getSource();
// Specify a calculation for the custom measure.
Source calculation = unitPrice.minus(unitCost);
// Create custom measure as a custom member of the MdmMeasureDimension.
MdmMeasure mdmMarkup = mdmMeasDim.createCustomMeasure("MARKUP_AW",
rootSchema,
calculation,
10);
// Set the short and long value descriptions.
mdmMarkup.setShortDescription("UNIT_PRICE_AW MINUS UNIT_COST_AW");