Page 1 of 1

Subsetdefinition don't accept foreign Dimension

Posted: Tue Dec 03, 2024 7:55 am
by schlemiel29
Hi all,
I discovered a strange behavior. I use a cube with dimensions, which have the same elements as the dimeniion in which I want to define a dynamic MDX based subset. So I have I dimension "KW" and a cube (}FILTER_KW_ORG) with 4 dimensions: }KW_N, }KW_N_Von, }KW_N_Bis and }FILTER_KW.
The dimension }KW_N owns the same elements than KW, but are all n elements.

To define a subset based on this cube I try to use:

Code: Select all

{ FILTER (
  { TM1SUBSETALL( [KW] )},
  [}FILTER_KW_ORG].(
    [KW].CurrentMember,  
    StrToMember( "[}KW_N_Von].["+ [}TM1Config_UserSelection].( StrToMember( "[}Clients].["+USERNAME+"]"), [}TM1Config_UserSelectionDimElement].[}KW_N_Von] ) +"]") ,
    StrToMember( "[}KW_N_Bis].["+ [}TM1Config_UserSelection].( StrToMember( "[}Clients].["+USERNAME+"]"), [}TM1Config_UserSelectionDimElement].[}KW_N_Bis] ) +"]") ,
    StrToMember( "[}FILTER_KW].["+ [}TM1Config_UserSelection].( StrToMember( "[}Clients].["+USERNAME+"]"), [}TM1Config_UserSelectionDimElement].[}FILTER_KW] ) +"]") 
    ) > 0
) }
Problem ist the first parameter for the cube:

Code: Select all

[KW].CurrentMember
This is not accepted. I also tried

Code: Select all

[KW].CurrentMember.Name
Unsuccessful. But using a fixed string worked fine:

Code: Select all

{ FILTER (
  { TM1SUBSETALL( [KW] )},
  [}FILTER_KW].(
    StrToMember( "[}KW_N].["+ "202102" +"]"), 
    StrToMember( "[}KW_N_Von].["+ [}TM1Config_UserSelection].( StrToMember( "[}Clients].["+USERNAME+"]"), [}TM1Config_UserSelectionDimElement].[}KW_N_Von] ) +"]") ,
    StrToMember( "[}KW_N_Bis].["+ [}TM1Config_UserSelection].( StrToMember( "[}Clients].["+USERNAME+"]"), [}TM1Config_UserSelectionDimElement].[}KW_N_Bis] ) +"]") ,
    StrToMember( "[}FILTER_KW].["+ [}TM1Config_UserSelection].( StrToMember( "[}Clients].["+USERNAME+"]"), [}TM1Config_UserSelectionDimElement].[}FILTER_KW] ) +"]") 
    ) > 0
) }
When using exactly the same logik with the dimension used in the cube, it worked fine too:

Code: Select all

{ FILTER (
  { TM1SUBSETALL( [}KW_N] )},
  [}FILTER_KW].(
    [}KW_N].CurrentMember, 
    StrToMember( "[}KW_N_Von].["+ [}TM1Config_UserSelection].( StrToMember( "[}Clients].["+USERNAME+"]"), [}TM1Config_UserSelectionDimElement].[}KW_N_Von] ) +"]") ,
    StrToMember( "[}KW_N_Bis].["+ [}TM1Config_UserSelection].( StrToMember( "[}Clients].["+USERNAME+"]"), [}TM1Config_UserSelectionDimElement].[}KW_N_Bis] ) +"]") ,
    StrToMember( "[}FILTER_KW].["+ [}TM1Config_UserSelection].( StrToMember( "[}Clients].["+USERNAME+"]"), [}TM1Config_UserSelectionDimElement].[}FILTER_KW] ) +"]") 
    ) > 0
) }
So I used two cubes with the apropriate dimensions to setup the subsets, but is there a more elegant solution? Why couldn't I use string manipulation to get a plain string like "202102"?
Thanks in advance
Dirk

Re: Subsetdefinition don't accept foreign Dimension

Posted: Tue Dec 03, 2024 7:34 pm
by burnstripe
Have you tried this

Code: Select all

FILTER (
  { TM1SUBSETALL( [KW] )},
  [}FILTER_KW].(
    StrToMember( "[}KW_N].["+ [KW].CurrentMember.Name +"]"), 
    StrToMember( "[}KW_N_Von].["+ [}TM1Config_UserSelection].( StrToMember( "[}Clients].["+USERNAME+"]"), [}TM1Config_UserSelectionDimElement].[}KW_N_Von] ) +"]") ,
    StrToMember( "[}KW_N_Bis].["+ [}TM1Config_UserSelection].( StrToMember( "[}Clients].["+USERNAME+"]"), [}TM1Config_UserSelectionDimElement].[}KW_N_Bis] ) +"]") ,
    StrToMember( "[}FILTER_KW].["+ [}TM1Config_UserSelection].( StrToMember( "[}Clients].["+USERNAME+"]"), [}TM1Config_UserSelectionDimElement].[}FILTER_KW] ) +"]") 
    ) > 0
) }
When using exactly the 
Note the [KW].CurrentMember.Name within the strtomember

Re: Subsetdefinition don't accept foreign Dimension

Posted: Wed Dec 04, 2024 10:23 am
by MarenC
Hi,

I am not sure I would call this strange behaviour, and I am also wondering why you didn't just put the KW dimension in the }FILTER_KW_ORG cube, instead of }KW_N? This would have avoided the issue I think.

Maren

Re: Subsetdefinition don't accept foreign Dimension

Posted: Thu Dec 05, 2024 10:22 am
by schlemiel29
Oh, that's simple. I want a flat dimension (}KW_N) , so I don't need any special rule or feeders. Just take the data from another cube.

Re: Subsetdefinition don't accept foreign Dimension

Posted: Thu Dec 05, 2024 10:25 am
by schlemiel29
@burnstripe: Yes, I also tried "[KW].CurrentMember.Name". So I didn't understand, what kind of data is
- CurrentMember.Name
- CurrentMember

I assumed they are simply strings, so if "202101" works, it should work with any kind of strings.

Re: Subsetdefinition don't accept foreign Dimension

Posted: Thu Dec 05, 2024 10:56 am
by MarenC
Oh, that's simple. I want a flat dimension (}KW_N) , so I don't need any special rule or feeders. Just take the data from another cube.
How would a flat dimension affect any of that? You just ensure the front end doesn't include any parent levels for this cube.

Re: Subsetdefinition don't accept foreign Dimension

Posted: Thu Dec 05, 2024 11:30 am
by schlemiel29
If this is a dimension with all elements as N elements, a rule will always be a N rule, but as fast as a C rule, because it simply does the calculation for itself (one time) without further aggregation.

Re: Subsetdefinition don't accept foreign Dimension

Posted: Thu Dec 05, 2024 11:57 am
by MarenC
If this is a dimension with all elements as N elements, a rule will always be a N rule, but as fast as a C rule, because it simply does the calculation for itself (one time) without further aggregation.
Well you can define rules at n level in TM1 whether there are consolidated elements in the dimension or not, so I still don't get it.