Distinguish String elements in an MDX

Post Reply
Wim Gielis
MVP
Posts: 3120
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Distinguish String elements in an MDX

Post by Wim Gielis »

Hello all,

As the title of the topic says, does anyone know how to distinguish string elements from numeric elements in an MDX-statement ?
I would like to, for example, have an MDX-driven subset on a dimension, that filters out all lowest-level numeric elements - no string elements.

I checked the properties, CurrentMember and so on, but could not find anything useful. Maybe it's because TM1 does not expose this information in its application of MDX statements ?

Thanks !
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
declanr
MVP
Posts: 1815
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: Distinguish String elements in an MDX

Post by declanr »

Not aware of any mdx filter function for it but I can't say I have ever tried; if there was a function I would assume it must be a TM1 specific function as opposed to standard MDX.

Suppose to get around it you could have a TI populate an attribute on the dim that just places the result of a DType in the attribute. Then filter that in the MDX.
Declan Rodger
Wim Gielis
MVP
Posts: 3120
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Distinguish String elements in an MDX

Post by Wim Gielis »

Thank you Declan. You confirm my findings.

The purpose is to only use MDX, such that the dynamic subset responds to changing dimension elements/hierarchies without running any additional TI process.
I would also like to avoid a rule with Dtype.

Thanks !
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
User avatar
gtonkin
MVP
Posts: 1202
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: Latest and greatest
Excel Version: Office 365 64-bit
Location: JHB, South Africa
Contact:

Re: Distinguish String elements in an MDX

Post by gtonkin »

Hi Wim,
I generally ensure all my N and C measures have formats configured with comma, percentage etc. etc. The remaining measures would then generally be the strings.
I then use MDX as follows to select them:

Code: Select all

FILTER([Measures].Members, [Measures].Currentmember.Properties("Format") = "")
Obviously not fool-proof but in your case I get the feeling you are meticulous so should work.
Wim Gielis
MVP
Posts: 3120
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Distinguish String elements in an MDX

Post by Wim Gielis »

Hello gtonkin,

Thanks, it's 1 step in the good direction, I hadn't thought of that.
I'll be looking for other solutions and keep this one in mind.

Wim
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
lotsaram
MVP
Posts: 3654
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Distinguish String elements in an MDX

Post by lotsaram »

Wim Gielis wrote:Thank you Declan. You confirm my findings.

The purpose is to only use MDX, such that the dynamic subset responds to changing dimension elements/hierarchies without running any additional TI process.
I would also like to avoid a rule with Dtype.

Thanks !
Why don't you want to set an Attribute with DType?
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
ardi
Community Contributor
Posts: 152
Joined: Tue Apr 02, 2013 1:41 pm
OLAP Product: tm1, cognos bi
Version: from TM1 9.4 to PA 2.0.9.6
Excel Version: 2010
Location: Toronto, ON

Re: Distinguish String elements in an MDX

Post by ardi »

I have done this with a Text Attribute Element_Type and in the TI that loads my measures dimension, I populate this attribute, but you can have a Rule to automatically maintain that attribute. Basically same this as lotsaram is proposing.
Ardian Alikaj
Wim Gielis
MVP
Posts: 3120
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Distinguish String elements in an MDX

Post by Wim Gielis »

Hello all,

Thanks for the replies.

The scenario is as follows: I would like to use TI to create an MDX-driven subset to gather orphan elements.
I could do this in 1 dimension, or all dimensions of a certain cube, or all application dimensions, ...
I would prefer to only do the SubsetCreateByMDX and that's it. No additional attributes dimensions and cubes, no rules, and so on.

Whenever the dimension changes, the subset should update (as is usual with dynamic subsets :) ) without running the TI process again.

And by any chance... a method that is fool-proof :D

Wim
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
User avatar
gtonkin
MVP
Posts: 1202
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: Latest and greatest
Excel Version: Office 365 64-bit
Location: JHB, South Africa
Contact:

Re: Distinguish String elements in an MDX

Post by gtonkin »

Cannot do fool-proof but may have last resort for you as follows:

Code: Select all

FILTER(
FILTER(
FILTER( [Measures].Members,
COUNT([Measures].CurrentMember.Ancestors)=0),
COUNT([Measures].CurrentMember.Children)=0),
[Measures].Currentmember.Properties("Format") <> "")
OR

Code: Select all

FILTER(
FILTER(
FILTER( [Measures].Members,
[Measures].CurrentMember.Parent.Name=""),
COUNT([Measures].CurrentMember.Children)=0),
[Measures].Currentmember.Properties("Format") <> "")
I have not been able to establish what, if any Property could be used to derive the DType and filter on Simple, Consolidated or String - may someone else has stumbled onto this and can share then you would have your solution.
ardi
Community Contributor
Posts: 152
Joined: Tue Apr 02, 2013 1:41 pm
OLAP Product: tm1, cognos bi
Version: from TM1 9.4 to PA 2.0.9.6
Excel Version: 2010
Location: Toronto, ON

Re: Distinguish String elements in an MDX

Post by ardi »

Wim Gielis wrote:Hello all,

Thanks for the replies.

The scenario is as follows: I would like to use TI to create an MDX-driven subset to gather orphan elements.
I could do this in 1 dimension, or all dimensions of a certain cube, or all application dimensions, ...
I would prefer to only do the SubsetCreateByMDX and that's it. No additional attributes dimensions and cubes, no rules, and so on.

Whenever the dimension changes, the subset should update (as is usual with dynamic subsets :) ) without running the TI process again.

And by any chance... a method that is fool-proof :D

Wim
By Orphan Elements you mean leaf numeric elements that do not have a parent? In that case you can write an MDX to do that, but if you want to distinguish String Elements from N elements that I dont think you can achieve it without additional attributes.
Ardian Alikaj
Wim Gielis
MVP
Posts: 3120
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Distinguish String elements in an MDX

Post by Wim Gielis »

ardi wrote:By Orphan Elements you mean leaf numeric elements that do not have a parent? In that case you can write an MDX to do that, but if you want to distinguish String Elements from N elements that I dont think you can achieve it without additional attributes.
That's indeed the subject of this topic :)

I had hoped for a reliable MDX-way of separating n and s type elements.
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Trevor MacPherson
Posts: 13
Joined: Mon Jun 03, 2013 8:45 pm
OLAP Product: TM1
Version: 10.2
Excel Version: None

Re: Distinguish String elements in an MDX

Post by Trevor MacPherson »

I might be missing something, but if the dimension had at least one cube that it was used in (as the format dimension), then an expression should demonstrate the strings like so:
EXCEPT({TM1SUBSETALL( [MyDim] )},{ FILTER( {TM1SUBSETALL( [MyDim] )}, [MyCube].[MyDim].CurrentMember<3.402823E38 AND [MyCube].[MyDim].CurrentMember>-3.402823E38)})
It doesn't matter if the cube is populated or not.
I haven't tested thoroughly, but it works in the small sample of cubes I've tried.
Wim Gielis
MVP
Posts: 3120
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Distinguish String elements in an MDX

Post by Wim Gielis »

And then George Tonkin came with the solution ! :!: :D

Code: Select all

Filter( TM1SubsetAll( [Revenue_Msr] ), [Revenue_Msr].CurrentMember.Properties("ELEMENT_TYPE")="1")
1 = N type
2 = S type
3 = C type
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Mark RMBC
Community Contributor
Posts: 292
Joined: Tue Sep 06, 2016 7:55 am
OLAP Product: TM1
Version: 10.1.1
Excel Version: Excel 2010

Re: Distinguish String elements in an MDX

Post by Mark RMBC »

Talk about dogged persistence, an example to us all!

I was then wondering if Element_Weight would return anything but doesn't!

I did get Element_Index to work,

so for example,

Code: Select all

Filter( TM1SubsetAll( [Revenue_Msr] ), [Revenue_Msr].CurrentMember.Properties("ELEMENT_INDEX")>"2")
regards,

Mark
User avatar
gtonkin
MVP
Posts: 1202
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: Latest and greatest
Excel Version: Office 365 64-bit
Location: JHB, South Africa
Contact:

Re: Distinguish String elements in an MDX

Post by gtonkin »

Try something like this Mark:

Code: Select all

FILTER(TM1SubsetAll([account1]),
[account1].currentmember.properties("MEMBER_WEIGHT")<>"1.000000")

or
FILTER(TM1DrillDownMember(TM1SubsetAll([test]),ALL,Recursive),
StrToValue([test].currentmember.properties("MEMBER_WEIGHT"))=-1)
lotsaram
MVP
Posts: 3654
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Distinguish String elements in an MDX

Post by lotsaram »

Wim Gielis wrote: Thu Oct 21, 2021 9:04 pm And then George Tonkin came with the solution ! :!: :D

Code: Select all

Filter( TM1SubsetAll( [Revenue_Msr] ), [Revenue_Msr].CurrentMember.Properties("ELEMENT_TYPE")="1")
1 = N type
2 = S type
3 = C type
I wish there was a like or +1 button. I never knew this.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
Mark RMBC
Community Contributor
Posts: 292
Joined: Tue Sep 06, 2016 7:55 am
OLAP Product: TM1
Version: 10.1.1
Excel Version: Excel 2010

Re: Distinguish String elements in an MDX

Post by Mark RMBC »

Hi George,

The Member_Weight does work, how long has that been around?

I obviously need to pay more attention ;)

regards,

Mark
User avatar
gtonkin
MVP
Posts: 1202
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: Latest and greatest
Excel Version: Office 365 64-bit
Location: JHB, South Africa
Contact:

Re: Distinguish String elements in an MDX

Post by gtonkin »

Mark RMBC wrote: Fri Oct 22, 2021 8:27 am Hi George,

The Member_Weight does work, how long has that been around?

I obviously need to pay more attention ;)

regards,

Mark
Probably since forever but undocumented like many other functions and properties unfortunately.
Mark RMBC
Community Contributor
Posts: 292
Joined: Tue Sep 06, 2016 7:55 am
OLAP Product: TM1
Version: 10.1.1
Excel Version: Excel 2010

Re: Distinguish String elements in an MDX

Post by Mark RMBC »

Cheers George.

I even asked IBM about this, re this forum discussion:

viewtopic.php?t=14986

It is even undocumented to them!

Good work for joining the dots 👏
Wim Gielis
MVP
Posts: 3120
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Distinguish String elements in an MDX

Post by Wim Gielis »

lotsaram wrote: Fri Oct 22, 2021 8:12 am
Wim Gielis wrote: Thu Oct 21, 2021 9:04 pm And then George Tonkin came with the solution ! :!: :D

Code: Select all

Filter( TM1SubsetAll( [Revenue_Msr] ), [Revenue_Msr].CurrentMember.Properties("ELEMENT_TYPE")="1")
1 = N type
2 = S type
3 = C type
I wish there was a like or +1 button. I never knew this.
Credits to George
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Post Reply