Need help on MDX

Post Reply
wbf
Posts: 12
Joined: Thu Nov 25, 2021 1:09 am
OLAP Product: TM1
Version: 10.2.0
Excel Version: 2013

Need help on MDX

Post by wbf »

Hello, I need help on getting this MDX to work
In a cube view, I'm trying to set the values to be displayed for dim01, subjected to selection of dim2 element and attributes of the selected dim2 element

CURRENTMEMBER.PROPERTIES work fine but CURRENTMEMBER.PROPERTIES().PROPERTIES() doesn't work.

TM1SubsetToSet([dim01] ,
IIF([dim02].CURRENTMEMBER.PROPERTIES("att1").PROPERTIES("att2") = "xxx" , "subset_a" ,
IIF([dim02].CURRENTMEMBER.PROPERTIES("att1").PROPERTIES("att2") = "yyy" , "subset_b" , "subset_none")))

Can anyone help with the syntax.
Much appreciated!
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: Need help on MDX

Post by lotsaram »

wbf wrote: Mon Sep 11, 2023 7:57 am CURRENTMEMBER.PROPERTIES work fine but CURRENTMEMBER.PROPERTIES().PROPERTIES() doesn't work.
And why on earth would you expect this to work?
CurrentMember is obviously a member
CurrentMember.Properties("propertyName") returns a string

You cannot pass a string into an expression which requires a member.

From a logic perspective what you want to do can still work but you will need to wrap the first CurrentMember.Properties in a StringToMember function.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
wbf
Posts: 12
Joined: Thu Nov 25, 2021 1:09 am
OLAP Product: TM1
Version: 10.2.0
Excel Version: 2013

Re: Need help on MDX

Post by wbf »

Thanks.

I've tried that as well - since it says invalid MDX expression I thought of just putting the simplified version which represents the idea.

TM1SubsetToSet([dim01] ,
IIF(StrToMember([dim02].CURRENTMEMBER.PROPERTIES("att1")).PROPERTIES("att2") = "xxx" , "subset_a" ,
IIF(StrToMember([dim02].CURRENTMEMBER.PROPERTIES("att1")).PROPERTIES("att2") = "yyy" , "subset_b" , "subset_none")))
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: Need help on MDX

Post by gtonkin »

Have a look at the reference guide for more on how to use StrToMember per Lotsa's suggestion.
wbf
Posts: 12
Joined: Thu Nov 25, 2021 1:09 am
OLAP Product: TM1
Version: 10.2.0
Excel Version: 2013

Re: Need help on MDX

Post by wbf »

Hi thanks for the advice. the following works

TM1SubsetToSet([dim01] ,
IIF(StrToMember("[dim02].["+[dim02].CURRENTMEMBER.PROPERTIES("att1")+"]").PROPERTIES("att2") = "xxx" , "subset_a" ,
IIF(StrToMember("[dim02].["+[dim02].CURRENTMEMBER.PROPERTIES("att1")+"]").PROPERTIES("att2") = "yyy" , "subset_b" , "subset_none")))

Basically, the member requires some "wrapping"
Post Reply