// Measures can be predefined in the library and thereby reused in in multiple hypercubes. The alternative
        // is to define the measure directly in the hypercube.
        private static void AddLibraryMeasure(HyperCubeDef theHyperCube, string measureId)
        {
            // A library measure is referred to by the id used when creating it.
            var measure = new NxMeasure {
                LibraryId = measureId
            };

            theHyperCube.Measures = theHyperCube.Measures.Concat(new[] { measure });
        }
        private static void AddInlineMeasure(HyperCubeDef theHyperCube, string expression)
        {
            var inlineMeasure = new NxInlineMeasureDef {
                Def = expression
            };
            // Analogous to AddInlineDimension. This NxMeasure represents a measure directly defined in the hyper
            // cube definition. The alternative would be to refer to a predefined library dimension in which case
            // the property LibraryId would be used instead.
            var measure = new NxMeasure {
                Def = inlineMeasure
            };

            theHyperCube.Measures = theHyperCube.Measures.Concat(new[] { measure });
        }