MDX TM1FILTERBYPATTERN - from a subset

Post Reply
pmakulski
Posts: 60
Joined: Mon Jun 06, 2011 6:07 pm
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2010

MDX TM1FILTERBYPATTERN - from a subset

Post by pmakulski »

I want a dynamic subset that is based on a value stored in another dimension-subset.

I'm starting with this, which works fine:

{TM1FILTERBYPATTERN( {TM1SUBSETALL( [Organization] )},
"EC4GB"
)}

But what I actually want to test on is in another dimension subset: [ForecastOrg].[DynamicTop]
( Forecast org is a less deep hierarchy that has a common upper level)

This dynamic subset contains a single item which happens to be "EC4GB"

I've tried lots of variations of
{TM1FILTERBYPATTERN( {TM1SUBSETALL( [Organization] )},
[ForecastOrg].[DynamicTop]
)}

but none of them compile. Can this be done? What is the syntax.
THanks.
User avatar
qml
MVP
Posts: 1096
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: MDX TM1FILTERBYPATTERN - from a subset

Post by qml »

Not sure what you want to achieve exactly, but in this particular case you don't need TM1FILTERBYPATTERN. All you need is:

Code: Select all

{[ForecastOrg].[DynamicTop]}
Kamil Arendt
pmakulski
Posts: 60
Joined: Mon Jun 06, 2011 6:07 pm
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2010

Re: MDX TM1FILTERBYPATTERN - from a subset

Post by pmakulski »

{[ForecastOrg].[DynamicTop]} gives me a subset from the ForecastOrg Dimension
I actually want a subset from the Organization dimension.
From what I can tell, mdx relates the subset to the dimension first mentioned.

ForecastOrg is shallow
Total
-EC4IND
-EC4GB

Organization is deep
Total
-EC4IND
--7 more levels below
-EC4GB
-- 7 more levels below this.

ie. EC4GB is a child in ForecastOrg, but a Consolidation in ForecastOrg.
TrailRunnerMark
Posts: 9
Joined: Wed Mar 07, 2012 11:06 pm
OLAP Product: Cognos Express
Version: 10.2.2
Excel Version: 2007 2010
Location: Vancouver, Canada

Re: MDX TM1FILTERBYPATTERN - from a subset

Post by TrailRunnerMark »

I think it's the DynamicTop that is giving you problems. It doesn't seem to be recognized by TM1. If you type it into the expression window of the Subset Editor you get the same "Failed to compile MDX expression" message. What is the logic for the MDX to pick just the single element EC4GB from the multiple elements in ForecastOrg ? Perhaps a differnt expression will work.
rmackenzie
MVP
Posts: 733
Joined: Wed May 14, 2008 11:06 pm

Re: MDX TM1FILTERBYPATTERN - from a subset

Post by rmackenzie »

pmakulski wrote:I want a dynamic subset that is based on a value stored in another dimension-subset.
pmakulski wrote:{[ForecastOrg].[DynamicTop]} gives me a subset from the ForecastOrg Dimension
I actually want a subset from the Organization dimension.
So you want a dynamic subset in the ForecastOrg dimension that refers to a subset in the Organization dimension? I don't think that it is possible to refer to a dimension (in your MDX) other than the one for which you are writing the expression. Are you getting the 'incorrect dimension for subset' error?
Robin Mackenzie
pmakulski
Posts: 60
Joined: Mon Jun 06, 2011 6:07 pm
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2010

Re: MDX TM1FILTERBYPATTERN - from a subset

Post by pmakulski »

Doh!
OK, I've read over the suggestions. Thanks for them.

The easy answer to my problem above was to replicate the [DynamicTop] subset in the Organization dimension.

[ForecastOrg].[DynamicTop] is

Code: Select all

{FILTER(  {TM1SUBSETALL([ForecastOrg])} , 
          [Forecast].CurrentMember.Name = 
                  [}ElementAttributes_}Clients].(StrToMember("[}Clients].[" +  USERNAME +"]"),[}ElementAttributes_}Clients].[DefaultTop])
     )}
So [Organization].[DynamicTop] can be

Code: Select all

{FILTER(  {TM1SUBSETALL([Organization])} , 
          [Organization].CurrentMember.Name = 
                  [}ElementAttributes_}Clients].(StrToMember("[}Clients].[" +  USERNAME +"]"),[}ElementAttributes_}Clients].[DefaultTop])
     )}
So now they both return the single item EC4GB (if that is what the }Client DefaultTop attribute calls for.

But I think the reason I wanted to reference the other dimension's subset was to do more than one item. (I got around the problem by making the needed subset on the fly in a TI,
but I think it is still an interesting exercise).

Basically {TM1Filter( {TM1SUBSETALL([Organization]), {This other list of similar looking items from [ForecastOrg].[AnotherSubset] )};
Post Reply