MDX to create subset using subset from another dimension

Post Reply
lav4you
Posts: 51
Joined: Fri Jan 02, 2009 1:20 pm

MDX to create subset using subset from another dimension

Post by lav4you »

Hi,

I have two similar dimensions where the leaf level comprises shared elements.
Lets call them Dim-A and Dim-B.
Dim-A has a subset called 'product'.
Using MDX I would like to create a subset in Dim-B by referencing the named subset of Dim-A.

I understand this would require the Generate MDX function, and I have tried the following but it does not work.

Code: Select all

Generate( 
	{TM1SubsetAll([Dim-A])},
	Filter( 
		TM1SubsetToSet([Dim-B], "Product"), 
		[Dim-B].CurrentMember.Name = [Dim-A].CurrentMember.Name
		)
)
I see the following Error Messsage
MDX error
Validation failed.
The server is temporarily unable to service your request due to a TM1 execution error. Please try again later or contact your administrator.
I think I am missing a trick here.

Can someone please help me to build this query.

Thanks in Advance.

Regards,

Lav
lav4you
Posts: 51
Joined: Fri Jan 02, 2009 1:20 pm

Re: MDX to create subset using subset from another dimension

Post by lav4you »

Hi

I found the answer. I am sharing it here just in case if anyone else is looking for the same.

Code: Select all

GENERATE(
	{ TM1SubsetToSet([Dim-B] , "Product") }, 
	FILTER(
		TM1SUBSETALL([Dim-A]) , [Dim-A].CURRENTMEMBER.NAME = [Entity].CURRENTMEMBER.NAME
		)
)
)

The mistake I made earlier was assuming that the first argument of the generate statement must originate from the same dimension from which I am currently writing the query..

Code: Select all

{ TM1SubsetToSet([Dim-B] , "Product") }
Good learning..


Regards,

Lav
Post Reply