RebaseDate: Variant;
The RebaseDate property determines a base period for calculating aggregation.
To set the calculation level of the Rebase function to RebaseDate, pass the array, the first element of which is the calculation frequency, the second is the date. If the calculation level Rebase must match with the model calculation level, the date is passed in RebaseDate (the string view of the date is allowed).
If the date is passed to RebaseDate as a string, the property use is given in the example for IMsCrossDimensionAggregationOptions.LevelValue.
The example below shows an array passed in RebaseDate.
Executing the example requires that the repository contains a time series database with the FC identifier. A modeling container of this database must include a model with the MODEL_AGGR identifier calculated using extended aggregation.
Sub UserProc;
Var
mb: IMetabase;
RubrDescr: IMetabaseObjectDescriptor;
Rubr: IRubricator;
msDescr: IMetabaseObjectDescriptor;
Model: IMsModel;
Transform: IMsFormulaTransform;
Formula: IMsFormula;
Aggr: IMsCrossDimensionAggregationTransform;
strsGen: IMsFormulaStringGenerator;
Options: IMsCrossDimensionAggregationOptions;
RebaseDate: Array[2] Of Variant;
Begin
mb := MetabaseClass.Active;
RubrDescr := mb.ItemById("FC");
Rubr := RubrDescr.Bind As IRubricator;
msDescr := Rubr.ModelSpace;
Model := mb.ItemByIdNamespace("MODEL_AGGR", msDescr.Key).Edit As IMsModel;
Transform := Model.Transform;
Formula := Transform.FormulaItem(0);
Aggr := Formula.Method As IMsCrossDimensionAggregationTransform;
Aggr.AgregationMethod := MsAgregationMethodType.Sum;
Options := Aggr.Options;
Options.Threshold := 0;
Options.Rebase := True;
RebaseDate[0] := DimCalendarLevel.Year;
RebaseDate[1] := DateTime.ComposeDay(2002, 1, 1);
Options.RebaseDate := RebaseDate;
Options.UseFillGaps := False;
strsGen := Formula.CreateStringGenerator;
strsGen.ShowFullVariableNames := True;
Debug.WriteLine("Aggregation expression: " + strsGen.Execute);
(Model As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the following model parameters are changed:
The base period is set as 2002, calculation step is set as years.
The threshold for aggregation relevance is set.
Aggregation is calculated ignoring the missing data treatment method.
The expression, by which aggregation is calculated, is displayed in the console window. For example:
Aggregation expression: World for publication|BCA[t] = Rebase(Sum((BCA[t]) * (BCI[t])) / Sum(BCI[t]), 01.01.2002)
See also: