MDX filter according to attribute of current user

Post Reply
jamesbennett
Posts: 28
Joined: Wed Aug 08, 2018 10:01 am
OLAP Product: IBM Cognos TM1
Version: 10.2.2
Excel Version: 2016

MDX filter according to attribute of current user

Post 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.
Mark RMBC
Community Contributor
Posts: 296
Joined: Tue Sep 06, 2016 7:55 am
OLAP Product: TM1
Version: 10.1.1
Excel Version: Excel 2010

Re: MDX filter according to attribute of current user

Post by Mark RMBC »

Hi,

How about:

Code: Select all

{FILTER({[Organisation].Members}, [Organisation].currentmember.name = StrToMember ( "[}Clients].[" + UserName + "]" ).properties("Department"))}
regards,
Mark
jamesbennett
Posts: 28
Joined: Wed Aug 08, 2018 10:01 am
OLAP Product: IBM Cognos TM1
Version: 10.2.2
Excel Version: 2016

Re: MDX filter according to attribute of current user

Post by jamesbennett »

Thanks Mark, that works perfectly!
Post Reply