MDX , create subset by value in other cube
-
- Posts: 23
- Joined: Mon Mar 23, 2015 12:08 am
- OLAP Product: TM1
- Version: Planning Analytics
- Excel Version: 2007
MDX , create subset by value in other cube
I have a value written in one of the lookup cubes (Example: W010215, W050115, W040115) and on the basis of first 3 characters want to create subset in another dimension which has values like W01, W02, W03....
So whatever the value is in lookup cube, should become the basis for subset in another dimension.
Can somebody guide me if this is possible.
So whatever the value is in lookup cube, should become the basis for subset in another dimension.
Can somebody guide me if this is possible.
-
- MVP
- Posts: 733
- Joined: Wed May 14, 2008 11:06 pm
Re: MDX , create subset by value in other cube
TM1 supports the LEFT function - it may likely be un-documented and differ between versions etc.
Anyway, you can do something like this:
Note the concatenation of the wildcard character (*) at the end of the filter.
Anyway, you can do something like this:
Code: Select all
{TM1FILTERBYPATTERN(
{TM1SUBSETALL([Interesting W Things])},
LEFT(
[Control Cube].(
[Control Parameter Dimension].[Some Parameter],
[Control Measure Dimension].[String]
),
3
) + "*"
)}
Robin Mackenzie
-
- Posts: 23
- Joined: Mon Mar 23, 2015 12:08 am
- OLAP Product: TM1
- Version: Planning Analytics
- Excel Version: 2007
Re: MDX , create subset by value in other cube
Thanks a lot, it is working fine, however giving all levels of elements starting with the 3 characters selected. Can it be restricted to 0 Level only ?
-
- Community Contributor
- Posts: 154
- 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: MDX , create subset by value in other cube
You can embed the above statement with TM1FILTERBYLEVEL and that will give you only level zero elementssk1080in wrote:Thanks a lot, it is working fine, however giving all levels of elements starting with the 3 characters selected. Can it be restricted to 0 Level only ?
Ardian Alikaj
-
- Community Contributor
- Posts: 324
- Joined: Mon Jul 02, 2012 9:39 pm
- OLAP Product: TM1
- Version: PAL 2.0.8
- Excel Version: 2016
- Location: Sydney, Australia
Re: MDX , create subset by value in other cube
You are right, it's not documented anywhere.TM1 supports the LEFT function - it may likely be un-documented and differ between versions etc.
BTW RIGHT function is supported too (not documented of course)
-
- Posts: 23
- Joined: Mon Mar 23, 2015 12:08 am
- OLAP Product: TM1
- Version: Planning Analytics
- Excel Version: 2007
Re: MDX , create subset by value in other cube
Thanks a lot everyone, it has worked for me. Last question...Can I pick something from between as well ? Like start from 4th Character and pick 2 Characters ?
-
- Community Contributor
- Posts: 324
- Joined: Mon Jul 02, 2012 9:39 pm
- OLAP Product: TM1
- Version: PAL 2.0.8
- Excel Version: 2016
- Location: Sydney, Australia
Re: MDX , create subset by value in other cube
To my knowledge (and from testing) MID function is not supported in TM1 MDX.
-
- MVP
- Posts: 733
- Joined: Wed May 14, 2008 11:06 pm
Re: MDX , create subset by value in other cube
But you can achieve the output of a MID if you have LEFT, RIGHT and LEN. E.g. this will work:EvgenyT wrote:To my knowledge (and from testing) MID function is not supported in TM1 MDX.
Code: Select all
{TM1FILTERBYPATTERN(
{TM1FILTERBYLEVEL(
{TM1SUBSETALL([Interesting W Things])},
0
)},
LEFT(
RIGHT(
[Control Cube].(
[Control Parameter Dimension].[Some Parameter],
[Control Measure Dimension].[String]
),
LEN(
[Control Cube].(
[Control Parameter Dimension].[Some Parameter],
[Control Measure Dimension].[String]
)
) - 4 + 1
), 2
) + "*"
)}
Robin Mackenzie
-
- Posts: 23
- Joined: Mon Mar 23, 2015 12:08 am
- OLAP Product: TM1
- Version: Planning Analytics
- Excel Version: 2007
Re: MDX , create subset by value in other cube
Brilliant Solution, Thanks for that. You are a Star.