Formulas for Defining Measures

Formulas are used in measure and constraint definitions. They consist of row source variables, cube locations, and functions. Formulas are restricted by the dense and sparse dimensions of the cube to which they belong.

The computation of a measure consists of the following elements:

Dense calculations are defined by formulas, and sparse calculations are defined by batch formulas and on-change formulas. Sparse calculations can be roll-up or allocation.

Every formula has a scope. For example, a dense formula and its scope define a family of formulas for the cubular cells in the scope. The dense formula is a multidimensional formula, and the formulas in the family are expanded formulas.

When writing formulas, keep in mind the following points:

Tip:

To avoid ambiguity when using names that could imply multiple objects (dimensions, members, hierarchies, or levels) in a measure formula, use a casting function to convert to the correct type.

In the following example, “dimension(Mode)” converts the name “Mode” to a dimension object.

"Projected Fuel Surcharge" =
if (memberName(dimension(Mode)) == "TRUCK",
 
"Projected Fuel Surcharge Rate",
"Projected Line Haul Rate"
)

Other casting functions include cube, dimensionMember, hierarchy, hierarchy, hierarchyLevel, and location. See Member Functions.