I'm trying to write a MDX filter statement to return years from 2018 to upcoming budget year (say 2024 for now).
This one works.
Code: Select all
vIndexDim = 1;
WHILE(TABDIM(vCube, vIndexDim) @<> '');
vDimName = TABDIM(vCube, vIndexDim);
SubsetDestroy(vDimName,vSubset);
IF( vDimName @='Year');
vMDX= ' {FILTER
(
TM1FILTERBYLEVEL (
TM1DRILLDOWNMEMBER( {[' | vDimName| '].[(ALL YEARS)]}, ALL, RECURSIVE)
,0
)
,StrToValue ( [' | vDimName| '].currentmember.name )>2017
AND
StrToValue ( [' | vDimName| '].currentmember.name )<= 2024
)
}';
ELSE;
vMDX = '{TM1FILTERBYLEVEL( TM1SUBSETALL( [' | vDimName | ']), 0)}';
ENDIF;
SubsetCreateByMDX(vSubset, vMDX);
ViewSubsetAssign(vCube, vView, vDimName, vSubset);
vIndexDim = vIndexDim +1;
END;
Code: Select all
pCurrentBudgetYear = StringToNumber(CellGetS('Control','Current Budget Year', 'svalue'));
Code: Select all
StrToValue ( [' | vDimName| '].currentmember.name )<= 2024
Kenneth