Code: Select all
SubsetCreateByMDX (SubNameSRC,
'{FILTER({TM1FILTERBYLEVEL(
{TM1SUBSETALL( [Period] )}, 0)},
[Config_JPS].( [Year].[FY17], [Scenario_Plan].[FC0517], [Config_Measure].[Source]) > 0 )}'
);
Code: Select all
SubsetCreateByMDX (SubNameSRC,
'{FILTER({TM1FILTERBYLEVEL(
{TM1SUBSETALL( [Period] )}, 0)},
[Config_JPS].( [Year].[FY17], [Scenario_Plan].[FC0517], [Config_Measure].[Source]) > 0 )}'
);
Code: Select all
sMDX='{FILTER({TM1FILTERBYLEVEL(
{TM1SUBSETALL( [Period] )}, 0)},
[Config_JPS].( [Year].[' | sYear |'], [Scenario_Plan].[' | sScenario |'], [Config_Measure].[Source]) > 0 )}'
SubsetCreateByMDX (SubNameSRC, sMDX);
You just assign the MDX statement to a String Variable and then you concatenate the Static Part of your MDX with the variable part.RonLat wrote: ↑Mon Oct 30, 2017 11:37 am using a MDX statement, it is possible to create a subset by filtering the values of a cube. However, it is necessary to explicitly name the dimensions and elements of the cube. In my case, the [Period] and [Config_Measure].[Source] are constants in the MDX statement below. I'd like to vary the elements [Year].[FY17] and [Scenario_Plan].[FC0517], because I need the process to create different subsets for [Period] in dependence of the selected elements in the dimension [Year] and [Scenario_Plan]. Is there any possibility to use TI Parameters as variables for the selection of the elements? If not, any idea how to solve this problem?
Code: Select all
SubsetCreateByMDX (SubNameSRC, '{FILTER({TM1FILTERBYLEVEL( {TM1SUBSETALL( [Period] )}, 0)}, [Config_JPS].( [Year].[FY17], [Scenario_Plan].[FC0517], [Config_Measure].[Source]) > 0 )}' );
To make the code easier to read, I switched to this:RonLat wrote: ↑Mon Oct 30, 2017 11:37 am using a MDX statement, it is possible to create a subset by filtering the values of a cube. However, it is necessary to explicitly name the dimensions and elements of the cube. In my case, the [Period] and [Config_Measure].[Source] are constants in the MDX statement below. I'd like to vary the elements [Year].[FY17] and [Scenario_Plan].[FC0517], because I need the process to create different subsets for [Period] in dependence of the selected elements in the dimension [Year] and [Scenario_Plan]. Is there any possibility to use TI Parameters as variables for the selection of the elements? If not, any idea how to solve this problem?
Code: Select all
strMDX = EXPAND('UNION( {[%dimName%].currentmember}
, FILTER( TM1SUBSETALL( [%dimName%] )
, [%cubName%].([%dimName1%].[%element%], ...) = %pParam1%)
, ALL)');
SubsetCreateByMDX(subName, strMDX);
SubsetElementDelete(dimName, subName, 1);