GENERATE STatement
Posted: Thu Mar 01, 2018 4:47 am
Hi,
Appreciate any help on the following.
Cube 1: CostCenterSelection
Dimensions: Cost Center, Version, Measures (SelectCC as string with value Yes/No)
MDX to filter Cost Centers that have "SelectCC" measure value "Yes":
FILTER(TM1FILTERBYLEVEL( TM1SUBSETALL( [Cost Center] ), 0),[CostCenterSelection].([Version].[Plan],[m_CCEmpSelection].[SelectCC])="Yes")
Cube 2: Employee
Dimensions: Cost Center, Employee, Version, Measures ( ShowEmp as Simple.)
MDX to filter Employees in Employee cube where "ShowEmp" = 1 and every Cost Center within "Total Cost Center" hierarchy:
GENERATE(
{TM1FILTERBYLEVEL( {TM1DRILLDOWNMEMBER( {TM1FILTERBYPATTERN( {TM1SUBSETALL( [Cost Center] )}, "Total Cost Center")}, ALL, RECURSIVE )}, 0)},
FILTER(TM1FILTERBYLEVEL( TM1SUBSETALL( [Employee] ), 0),[Employee].([Cost Center].currentmember,[Version].[Plan],[m_EmpCCAnnual].[ShowEmp])=1))
)
These MDXs work fine.
I'm trying to pass all Cost Centers which have "SelectCC" measure value = "Yes" from Cube 1 to Cube 2, which doesn't work:
GENERATE(
FILTER(TM1FILTERBYLEVEL( TM1SUBSETALL( [Cost Center] ), 0),[CostCenterSelection].([Version].[Plan],[m_CCEmpSelection].[SelectCC])="Yes")),
{FILTER(TM1FILTERBYLEVEL( TM1SUBSETALL( [Employee] ), 0),[Employee].([Cost Center].currentmember,[Version-Scenario].[Plan],[m_EmpCCAnnual].[ShowEmp])=1)})
BUT the following works if I pass first argument of GENERATE as dynamic subset instead :
GENERATE(
TM1SUBSETTOSET([Cost Center], "subset1"),
{FILTER(TM1FILTERBYLEVEL( TM1SUBSETALL( [Employee] ), 0),[Employee].([Cost Center].currentmember,[Version].[Plan],[m_EmpCCAnnual].[ShowEmp])=1)})
Subset1 MDX: FILTER(TM1FILTERBYLEVEL( TM1SUBSETALL( [Cost Center] ), 0),[CostCenterSelection].([Version].[Plan],[m_CCEmpSelection].[SelectCC])="Yes"))
Please advise..
Thanks,
Appreciate any help on the following.
Cube 1: CostCenterSelection
Dimensions: Cost Center, Version, Measures (SelectCC as string with value Yes/No)
MDX to filter Cost Centers that have "SelectCC" measure value "Yes":
FILTER(TM1FILTERBYLEVEL( TM1SUBSETALL( [Cost Center] ), 0),[CostCenterSelection].([Version].[Plan],[m_CCEmpSelection].[SelectCC])="Yes")
Cube 2: Employee
Dimensions: Cost Center, Employee, Version, Measures ( ShowEmp as Simple.)
MDX to filter Employees in Employee cube where "ShowEmp" = 1 and every Cost Center within "Total Cost Center" hierarchy:
GENERATE(
{TM1FILTERBYLEVEL( {TM1DRILLDOWNMEMBER( {TM1FILTERBYPATTERN( {TM1SUBSETALL( [Cost Center] )}, "Total Cost Center")}, ALL, RECURSIVE )}, 0)},
FILTER(TM1FILTERBYLEVEL( TM1SUBSETALL( [Employee] ), 0),[Employee].([Cost Center].currentmember,[Version].[Plan],[m_EmpCCAnnual].[ShowEmp])=1))
)
These MDXs work fine.
I'm trying to pass all Cost Centers which have "SelectCC" measure value = "Yes" from Cube 1 to Cube 2, which doesn't work:
GENERATE(
FILTER(TM1FILTERBYLEVEL( TM1SUBSETALL( [Cost Center] ), 0),[CostCenterSelection].([Version].[Plan],[m_CCEmpSelection].[SelectCC])="Yes")),
{FILTER(TM1FILTERBYLEVEL( TM1SUBSETALL( [Employee] ), 0),[Employee].([Cost Center].currentmember,[Version-Scenario].[Plan],[m_EmpCCAnnual].[ShowEmp])=1)})
BUT the following works if I pass first argument of GENERATE as dynamic subset instead :
GENERATE(
TM1SUBSETTOSET([Cost Center], "subset1"),
{FILTER(TM1FILTERBYLEVEL( TM1SUBSETALL( [Employee] ), 0),[Employee].([Cost Center].currentmember,[Version].[Plan],[m_EmpCCAnnual].[ShowEmp])=1)})
Subset1 MDX: FILTER(TM1FILTERBYLEVEL( TM1SUBSETALL( [Cost Center] ), 0),[CostCenterSelection].([Version].[Plan],[m_CCEmpSelection].[SelectCC])="Yes"))
Please advise..
Thanks,