ssas - Intersect Select Query in MDX -
i want have customers intersection in 2 mdx querys.
1.
select [measures].[cs] on 0 ,nonempty([customers].[customer].members) on 1 [sfe cube] ( [calend].[period].&[201506] ,[customers].[bp territory].&[38uz1] ,[materials].[brand].&[coca-cola] ); 2.
select [measures].[cs] on 0 ,nonempty([customers].[customer].members) on 1 [sfe cube] ( [calend].[period].&[201506] ,[customers].[bp territory].&[38uz1] ,[materials].[brand].&[fanta orange csd] ); my attempted mdx script:
select {} on columns, intersect( ( select [measures].[cs] on 0, nonempty([customers].[customer].members) on 1 [sfe cube] ([calend].[period].&[201506] ,[customers].[bp territory].&[38uz1] ,[materials].[brand].&[coca-cola]) ) , ( select [measures].[cs] on 0, nonempty([customers].[customer].members) on 1 [sfe cube] ([calend].[period].&[201506] ,[customers].[bp territory].&[38uz1] ,[materials].[brand].&[fanta orange csd])) ) on rows [sfe cube] when run query there error :
subselect support axis columns.
what doing wrong?
you can implement and logic:
with set [yourset] nonempty ( nonempty ( {[customers].[customer].members} ,{[materials].[brand].&[fanta orange csd]} ) ,{[materials].[brand].&[coca-cola]} ) select [measures].[cs] on 0 ,non empty [yourset] on 1 [sfe cube] ( [calend].[period].&[201506] ,[customers].[bp territory].&[38uz1] ); a different variant (that better) using exists detailed in post:
mdx query calculate measure , condition members same dimension
i sourav's idea intersect. think script can simplified this:
with set commoncustomers intersect ( nonempty ( [customers].[customer].members ,[materials].[brand].&[coca-cola] ) ,nonempty ( [customers].[customer].members ,[materials].[brand].&[fanta orange csd] ) ) select {[measures].[cs]} on columns ,non empty commoncustomers on rows [sfe cube] ( [calend].[period].&[201506] ,[customers].[bp territory].&[38uz1] );
Comments
Post a Comment