TM1TupleSize function

Post Reply
User avatar
PavoGa
MVP
Posts: 617
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0.9.1
Excel Version: 2013 PAW
Location: Charleston, Tennessee

TM1TupleSize function

Post by PavoGa »

How does this function work and how would one use it? I have been unable to find an example of its usage.
Ty
Cleveland, TN
User avatar
PavoGa
MVP
Posts: 617
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0.9.1
Excel Version: 2013 PAW
Location: Charleston, Tennessee

Re: TM1TupleSize function

Post by PavoGa »

Got word that IBM has never even had a support call on it. So either I am a complete idiot and cannot comprehend the Reference Guide entry on it or no one uses it. :lol:
Ty
Cleveland, TN
Wim Gielis
MVP
Posts: 3113
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: TM1TupleSize function

Post by Wim Gielis »

Hello Ty,

I don't find it a difficult function, even with limited documentation. But I have to admit that I don't know a lot of good uses for the function.

Here's an example with 2 dimensions. Say you have a Line dimension to capture input by the user. It has 100 elements, of which only a limlited number should show up for the user.
Below are the first 10 elements.
01.PNG
01.PNG (27.8 KiB) Viewed 3417 times
Then you have an Item dimension, containing elements:
02.PNG
02.PNG (20.61 KiB) Viewed 3417 times
You would like to filter the Lines to show the first 4 input lines, because you have 4 items in the dimension:
03.PNG
03.PNG (49.34 KiB) Viewed 3417 times
That might be one example.
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: TM1TupleSize function

Post by Trevor MacPherson »

Not sure I can imagine a lot of practical applications for TM1TupleSize (that aren't better served by the default behavior of other functions), but it "works" as far as I can tell.
It expects a tuple, and I think many of us more commonly work with sets, so that may throw some people of. To get a tuple from a set, you just need to specify the item in the collection.
Set:
{FILTER( {TM1SUBSETALL( [Weekly Performance] )}, [Weekly Performance].[enddate] < 20635)}
i.e. periods which end before July 1, 2016 (or June 29, 1956 depending on how you created your dates).
Tuple - for first item in the collection (set)
{FILTER( {TM1SUBSETALL( [Weekly Performance] )}, [Weekly Performance].[enddate] < 20635)}.Item(0)
- now, if you were to use this as a dynamic subset, it will fail to compile, because it is a tuple, not a set.
To convert it to a set:
{{FILTER( {TM1SUBSETALL( [Weekly Performance] )}, [Weekly Performance].[enddate] < 20635)}.Item(0)}

So, how might one use TM1TupleSize? The only thing I can imagine is to validate a set before creating it, possibly when creating from TI (i.e. to avoid "Unable to register Subset...", for which there are other, more common workarounds.
It could be something like - if there are no members in this, then show that ... the following is highly contrived, but:
If I have periods in my time dimension with end dates before July 1st, then populate my version dimension subset with "Actual", otherwise use "Forecast" (items 2 and 3 in my subset respectively)

{{TM1SUBSETALL( [Version] )}.Item(IIF(TM1TupleSize({FILTER( {TM1SUBSETALL( [Weekly Performance] )}, [Weekly Performance].[enddate] < 20635)}.Item(0))=0,2,3))}

Someone more creative than me can likely come up with better uses, but in any case, it does function, and return a 0 for tuples which don't exist.
User avatar
PavoGa
MVP
Posts: 617
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0.9.1
Excel Version: 2013 PAW
Location: Charleston, Tennessee

Re: TM1TupleSize function

Post by PavoGa »

Thank you, both.
So, how might one use TM1TupleSize? The only thing I can imagine is to validate a set before creating it, possibly when creating from TI (i.e. to avoid "Unable to register Subset...", for which there are other, more common workarounds.
Trevor, that is the only thing I had thought of and, as you point out, there are more common methods.

I was just doing work on some MDX subsets and saw it. Not being sure of exactly what it did and how it worked, figured fishing for innovative uses of it would not hurt.

Thanks again, guys.

Ty
Ty
Cleveland, TN
Post Reply