Automatically Expand Active Form Two Levels

Post Reply
rmjohnston
Posts: 4
Joined: Mon Jul 26, 2010 10:56 pm
OLAP Product: TM1
Version: 9.4
Excel Version: 2003 2007

Automatically Expand Active Form Two Levels

Post by rmjohnston »

I have created an TM1 Active Form in Excel 2007 using TM1 9.5.1 that uses a subset of Industry Groups in the rows position. This expands the Industry Group to list the Customers. The Customers have location codes as the next level. To automatically expand the Active Form so it is listing all Customers for the Industry Group the I put this MDX in the TM1RPTROW formula "{DRILLDOWNLEVEL({[MLOC].[MGMT - AIG DOM - CUSTOMERS]})}".

Does anyone have a suggestion how to automatically expand this Active Form one more level to show the Customers of that Industry Group and each Customers Location Codes?

- I tried to record a macro to do this and nothing is recorded when inside the Active Form area of the workbook.

- I tried using DrillDownlevel and specifying the level, but I loose the roll-up of Location Codes to Customer. Maybe I did that wrong.

- I don't want to use the TM!DrilldownMember because it returns all levels and there is one more level that has too much detail and makes the workbook too large.

To try and sum this up, I'm looking for suggestions to automatically drill two levels on an TM1 Active Form.

I appreciate your input,
Rhonda

This is what I get:
MGMT - AIG DOM - CUSTOMERS


+ CUSTOMER - AEES
+ CUSTOMER - BOBCAT
+ CUSTOMER - CATERPILLAR
+ CUSTOMER - DANA
+ CUSTOMER - DETROIT DIESEL
+ CUSTOMER - DIEBOLD
+ CUSTOMER - DTCI
+ CUSTOMER - FORD
+ CUSTOMER - GDX
+ CUSTOMER - GLEEN
+ CUSTOMER - GM
+ CUSTOMER - GMCCA
+ CUSTOMER - LAM RESEARCH
+ CUSTOMER - NAVISTAR
+ CUSTOMER - NEW BUSINESS
+ CUSTOMER - TAKATA
+ CUSTOMER - TOYOTA-WALKER
- MGMT - AIG Dom - Customers

This is a section of what I want:

MGMT - AIG DOM - CUSTOMERS
+ AED
+ AEM
+ AEP
+ AES
+ AET
- CUSTOMER - AEES
+ BOB
+ CBO
- CUSTOMER - BOBCAT
+ CAJ
+ CAL
+ CUK
- CUSTOMER - CATERPILLAR
+ DAE
+ DAM
+ DAN
+ WDN
- CUSTOMER - DANA


Note I have "expand above" selected and the section of "what I want" is just a sample.
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: Automatically Expand Active Form Two Levels

Post by declanr »

Code: Select all

{TM1FILTERBYLEVEL( {TM1DRILLDOWNMEMBER( {TM1FILTERBYPATTERN( {TM1SUBSETALL( [MLOC] )}, "MGMT - AIG Dom - Customers")}, ALL, RECURSIVE )}, 0,1,2)}
I am assuming that "MGMT - AIG Dom - Customers" is the top level in your dimension but if not just adjust the level selection accordingly.

Note that you could have recorded the expression within the subset editor to create the MDX to do this in a similar fashion to that which you can record an excel macro. There is also an MDX Primer available which you can find by searching the forum and that is fairly comprehensive.
Declan Rodger
User avatar
cdredmond
Posts: 23
Joined: Tue Sep 08, 2009 2:46 pm
OLAP Product: TM1
Version: SpreadsheetConnector4.0-10.2.2
Excel Version: v3 - 2013
Location: Tigard, OR (Portland, Oregon Metro area)
Contact:

Re: Automatically Expand Active Form Two Levels

Post by cdredmond »

Declanr is correct.
You can also take this one step further by placing the MDX expression in a dynamic subset and then simply refer to the dynamic subset in the Active Form. The benefit of this approach is that the subset is exposed in the system and available to other views as a "single version of the truth" instead of buried in a single workbook where it is not avaiable without replication/recreation for another workbook, cube view, etc. and creates a challenge when auditing your reporting tools inventory.
Best wishes rmjohnston!
Say "Hi" to the rest of the crew for me! :-)
Christopher Redmond
Senior TM1 Consultant
http://www.bpmnw.com
Office: (503) 747-2614
rmjohnston
Posts: 4
Joined: Mon Jul 26, 2010 10:56 pm
OLAP Product: TM1
Version: 9.4
Excel Version: 2003 2007

Re: Automatically Expand Active Form Two Levels

Post by rmjohnston »

Thank you both Declanr and Christopher. It works perfectly.

I updating the already dynamic subsets to expand to the levels needed. I don't know why I couldn't get that statement to record the way it needed to be for the levels desired.

Thank you both again.
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: Automatically Expand Active Form Two Levels

Post by lotsaram »

rmjohnston wrote:I don't know why I couldn't get that statement to record the way it needed to be for the levels desired.
The MDX recorder is pretty limited, it can give you a basic idea but to get to most expressions that you need in the real world you will need to type some code.
User avatar
jpm_de
Posts: 22
Joined: Thu Jun 10, 2010 5:19 pm
OLAP Product: TM1
Version: 10.2.2 FP3
Excel Version: 2010

Re: Automatically Expand Active Form Two Levels

Post by jpm_de »

In relation to the topic:

I tried the (adjusted) code and it did not work for me. Maybe, because I do have a ragged hierarchy, that is 10 levels deep at most.

Two questions of things I do not understand yet:

1. What is the benefit/intention of
{TM1FILTERBYPATTERN( {TM1SUBSETALL( [MLOC] )}, "MGMT - AIG Dom - Customers")}
instead of a simple
{[MLOC].[MGMT - AIG Dom - Customers]}
within the overall statement?

2. To my understanding, TM1FILTERBYLEVEL returns the bottom levels, not the top levels, because TM1 counts levels this way.
How does this help to get the top x levels of a larger (possibly ragged) hierarchy?

Thank you very much in advance!
Why TM1? Because ...with great dimensionality there must also come -- great responsibility!
(http://www.quotecounterquote.com/2012/0 ... great.html)
Wim Gielis
MVP
Posts: 3117
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: Automatically Expand Active Form Two Levels

Post by Wim Gielis »

jpm_de wrote:1. What is the benefit/intention of
{TM1FILTERBYPATTERN( {TM1SUBSETALL( [MLOC] )}, "MGMT - AIG Dom - Customers")}
instead of a simple
{[MLOC].[MGMT - AIG Dom - Customers]}
within the overall statement?
No benefit. The simpler, the better.
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
tomok
MVP
Posts: 2832
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Automatically Expand Active Form Two Levels

Post by tomok »

jpm_de wrote:To my understanding, TM1FILTERBYLEVEL returns the bottom levels, not the top levels, because TM1 counts levels this way.
How does this help to get the top x levels of a larger (possibly ragged) hierarchy?
FILTERBYLEVEL returns whatever level you ask for, not just bottom or top.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
User avatar
jpm_de
Posts: 22
Joined: Thu Jun 10, 2010 5:19 pm
OLAP Product: TM1
Version: 10.2.2 FP3
Excel Version: 2010

Re: Automatically Expand Active Form Two Levels

Post by jpm_de »

Exactly, TM1FILTERBYLEVEL returns the TM1 level you ask for.
I hoped and tried FILTERBYLEVEL, but in vain, TM1 does not know this function. At least not documented and I did not find a correct syntax.

Having a ragged hierarchy, on top with a varying depth, it is quite hard to determine, what to ask for in terms of TM1 levels:

Just a simple example:

Element TM1 vs. MDX Level
- Root 5 vs. 0

- A 2 vs. 1
- AA 1 vs. 2
- AAA 0 vs. 3

- B 3 vs. 1
- BB 2 vs. 2
- BBB 1 vs. 3
- BBBB 0 vs. 4

- C 4 vs. 1
- CC 3 vs. 2
- CCC 2 vs. 3
- CCCC 1 vs. 4
- CCCCC 0 vs. 5

Within such an example, I am not even able to filter the first MDX level using the TM1 levels, because A, B and C have different levels.

Note:
ELLEV returns TM1 levels, interestingly, the Active Form formula TM1RPTELLEV returns MDX levels, therefore TM1 is capable of providing MDX standard levels!
Why TM1? Because ...with great dimensionality there must also come -- great responsibility!
(http://www.quotecounterquote.com/2012/0 ... great.html)
User avatar
jpm_de
Posts: 22
Joined: Thu Jun 10, 2010 5:19 pm
OLAP Product: TM1
Version: 10.2.2 FP3
Excel Version: 2010

Re: Automatically Expand Active Form Two Levels

Post by jpm_de »

OK, one big step forward:

Using the supported MDX function DRILLDOWNLEVEL I am getting, what I wanted:

Within my example: DRILLDOWNLEVEL( {[Hierarchy Example].[Root]}) results in Root and A, B, C.

And I can easily nest the function as often as I want to drill to a deeper level, e.g. to MDX Level 4:
DRILLDOWNLEVEL(DRILLDOWNLEVEL(DRILLDOWNLEVEL( DRILLDOWNLEVEL( {[Hierarchy Example].[Root]}))))

Using multiple dynamic subsets for each Level, I was able to built a user-friendly drop-down for my active form to define the level of detail.
And thinking of it, there are a thousand situations, where this is helpful (e.g. action buttons for each or a specific level, user or role specific starting levels, etc.).

Unfortunately, I was not able to use the full official MDX syntax, especially the optional parameters to get rid of nesting the function:
see https://msdn.microsoft.com/en-us/library/ms144937.aspx

DrilldownLevel (MDX Syntax)

DrilldownLevel (Set_Expression [,[Level_Expression] ,[Index]] [,INCLUDE_CALC_MEMBERS])

I tried to define and use some MDX hierarchy names within }HierarchyProperties (and yes, I did the TI MDXHierarchyRefresh for the dimension).

Is there anybody, who has done this before or came up with a simple way of MDX statement without having to nest the function?
Why TM1? Because ...with great dimensionality there must also come -- great responsibility!
(http://www.quotecounterquote.com/2012/0 ... great.html)
Wim Gielis
MVP
Posts: 3117
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: Automatically Expand Active Form Two Levels

Post by Wim Gielis »

Hello,

Here is an example of the syntax to have all descendants of an element, except level 0:

Code: Select all

{EXCEPT( {DESCENDANTS([Customer].[Total Customer]) }, {TM1FILTERBYLEVEL({DESCENDANTS([Customer].[Total Customer])}, 0)} )}
I don't know how to shorten the syntax of the nested DRILLDOWNLEVEL functions, though. Maybe someone else will.
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: 1199
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: Automatically Expand Active Form Two Levels

Post by gtonkin »

Have you tried something like:

Code: Select all

TM1DRILLDOWNMEMBER(
TM1DRILLDOWNMEMBER(
{[MLOC].[MGMT - AIG DOM - CUSTOMERS]}
,ALL)
,ALL)
Note that the RECURSIVE parameter is not present. You can keep nesting the TM1DRILLDOWNMEMBERs
Post Reply