CalcMethod: CubeCalcMethod;
The CalcMethod property determines value calculation mode of calculated fact on cube creation.
Executing the example requires that the repository contains a standard cube with the STD_CUBE identifier. Cube fact dimension has at least three elements: two first elements are linked to the data source fields, the third element has no binding. Add links to the Cubes, Db, Dimensions and Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
StdCube: IStandardCube;
StdCubeDest: IStandardCubeDestination;
CalcBind: IStandardCubeCalculatedFactBinding;
Begin
MB := MetabaseClass.Active;
StdCube := MB.ItemById("STD_CUBE").Edit As IStandardCube;
StdCubeDest := StdCube.Destinations.Item(0);
//Binding of the calculated fact
CalcBind := StdCubeDest.CalcBindings.Binding(3) As IStandardCubeCalculatedFactBinding;
CalcBind.Formula.AsString := "(@[2]*100)/@[1]";
CalcBind.CalcMethod := CubeCalcMethod.BySelection;
(StdCube As IMetabaseObject).Save;
End Sub UserProc;
Example execution sets up cube calculated fact. Calculated fact formula calculates percent value of the second fact towards the first one. Calculation is made according to the cube selection.
See also: