Page 1 of 1

MDX filter according to attribute of current user

Posted: Tue Jan 28, 2020 10:20 am
by jamesbennett
I'm trying to set up a dynamic subset and have unsuccessfully been attempting to replicate the MDX code found here: viewtopic.php?t=14061

I have a dimension, 'Organisation'. The }Clients dimension has a 'Department' attribute. Every value of 'Department' matches an element or consolidation in the 'Organisation' dimension. I want to filter the 'Organisation' dimension to just the value of the 'Department' attribute for the current TM1 user.

I have adapted the code posted by declanr in the linked thread to be as follows, but for some reason I'm getting a syntax error at or near the = sign:

Code: Select all

{Filter(
	{[Organisation].members},
	[Organisation] = StrToMember ( "[}Clients].[" + UserName + "]" ).[Department] 
	 )
}
What am I doing wrong?

Edit: The code

Code: Select all

{StrToMember ( "[}Clients].[" + UserName + "]" )}
works as expected on the }Clients dimension.

Re: MDX filter according to attribute of current user

Posted: Tue Jan 28, 2020 10:54 am
by Mark RMBC
Hi,

How about:

Code: Select all

{FILTER({[Organisation].Members}, [Organisation].currentmember.name = StrToMember ( "[}Clients].[" + UserName + "]" ).properties("Department"))}
regards,
Mark

Re: MDX filter according to attribute of current user

Posted: Tue Jan 28, 2020 11:00 am
by jamesbennett
Thanks Mark, that works perfectly!