Ultimate Long TM1 quiz

Adam
Posts: 118
Joined: Wed Apr 03, 2019 12:10 am
OLAP Product: IBM PA
Version: 2.0.9.x
Excel Version: Microsoft 365 x64

Re: Ultimate Long TM1 quiz

Post by Adam »

Elessar wrote: Fri Oct 04, 2024 5:06 pm I'm noticing that participants became less active. 2 months left, pull yourselves together guys!
This is fun for me and we should keep going even beyond the two month mark. I we all want to play nice in the sandbox (who am I kidding Version dimension) so we’re not all immediately jumping in.
Elessar wrote: Fri Oct 11, 2024 3:23 pm Question #41:
The cube and rule are shown on screenshots below. B1 is not fed. What will be in C1? Will it take numbers from not-fed calculated cells of B1?
I remember to this day when I was learning TM1, I made a post-it note of how rules work as I was figuring it all out. One of the bullets was DB statement will always calculate correctly unless you’re referencing a consolidated cell that has unfed leaves. (Even then it’s correct, not summing its unfed leaves. It’s only “not correct” if the unfed leaf was unintentionally unfed.)

Therefore, you would see 1, 2, 3 in row C1.
I've started blogging about TM1, check it out: www.havaslabs.com

Take care,
Adam
User avatar
Elessar
Community Contributor
Posts: 401
Joined: Mon Nov 21, 2011 12:33 pm
OLAP Product: PA 2
Version: 2.0.9
Excel Version: 2016
Contact:

Re: Ultimate Long TM1 quiz

Post by Elessar »

Correct answer:
0, 1, 2, 3

Winner of this round is Adam!

Question #42:
You have TM1 server with sensitive data. You have a well-done security model in TM1: access to sensitive data is granted only to right users. But windows administrator can take DATA folder and launch it on his own TM1 server with his }Clientgrups cube file where he is admin. And thus get access to sensitive data. Can we do anything with this?
Best regards, Alexander Dvoynev

TM1 and Data Science blog: 7th article - Development requirements.
Adam
Posts: 118
Joined: Wed Apr 03, 2019 12:10 am
OLAP Product: IBM PA
Version: 2.0.9.x
Excel Version: Microsoft 365 x64

Re: Ultimate Long TM1 quiz

Post by Adam »

Elessar wrote: Fri Oct 18, 2024 5:51 pm Question #42:
You have TM1 server with sensitive data. You have a well-done security model in TM1: access to sensitive data is granted only to right users. But windows administrator can take DATA folder and launch it on his own TM1 server with his }Clientgrups cube file where he is admin. And thus get access to sensitive data. Can we do anything with this?
One approach could be to encrypt the contents of the data folder using the out-of-the-box encryption. Then, ensure the server admin doesn't have access to the keystore.
I've started blogging about TM1, check it out: www.havaslabs.com

Take care,
Adam
User avatar
Elessar
Community Contributor
Posts: 401
Joined: Mon Nov 21, 2011 12:33 pm
OLAP Product: PA 2
Version: 2.0.9
Excel Version: 2016
Contact:

Re: Ultimate Long TM1 quiz

Post by Elessar »

Which out-of-the-box encryption do you mean?
Best regards, Alexander Dvoynev

TM1 and Data Science blog: 7th article - Development requirements.
User avatar
Elessar
Community Contributor
Posts: 401
Joined: Mon Nov 21, 2011 12:33 pm
OLAP Product: PA 2
Version: 2.0.9
Excel Version: 2016
Contact:

Re: Ultimate Long TM1 quiz

Post by Elessar »

Correct answer:
Yes, you can encrypt DATA folder using TM1Crypt utility: https://www.ibm.com/docs/en/planning-an ... encryption

Winner of this round is Adam!

Question #43:
Optimize this rule: ['Y'] = IF(['X'] < 0, 0, ['X']);
Best regards, Alexander Dvoynev

TM1 and Data Science blog: 7th article - Development requirements.
ascheevel
Community Contributor
Posts: 304
Joined: Fri Feb 15, 2013 5:49 pm
OLAP Product: TM1
Version: PA 2.0.9.1
Excel Version: 365
Location: Minneapolis, USA

Re: Ultimate Long TM1 quiz

Post by ascheevel »

Code: Select all

['Y'] = MAX(0, ['X']);
MarenC
Regular Participant
Posts: 405
Joined: Sat Jun 08, 2019 9:55 am
OLAP Product: Planning Analytics
Version: Planning Analytics 2.0
Excel Version: Excel 2016

Re: Ultimate Long TM1 quiz

Post by MarenC »

['Y'] = MAX(0, ['X']);
It is clever but is that really optimised?

I will say this rule cannot be optimised but will throw this into the mix:

['Y'] = IF(['X'] < 0, STET, ['X']);

Maren
ascheevel
Community Contributor
Posts: 304
Joined: Fri Feb 15, 2013 5:49 pm
OLAP Product: TM1
Version: PA 2.0.9.1
Excel Version: 365
Location: Minneapolis, USA

Re: Ultimate Long TM1 quiz

Post by ascheevel »

MarenC wrote: Fri Oct 25, 2024 3:56 pm It is clever but is that really optimised?
I'll defer to Elessar's judgement on whether or not my suggestion was the optimization they were looking for, but I do believe Max/Min functions can be quite a bit faster than IF statement processing. I'm sure I've read a comment before by lotsa saying exactly this, but my memory isn't as good as it once was. This could of course be tested using }StatsByRule cube, but I haven't the time or energy this week to work up and execute a test scenario. It's also my opinion that my suggestion is easier to read than the original IF statement, but we always think our own solutions are the best and easiest to read. If it isn't just my opinion in this case, then I've optimized for both performance and readability.
Emixam
Regular Participant
Posts: 151
Joined: Tue May 21, 2019 3:33 pm
OLAP Product: TM1
Version: PA 2.0.x
Excel Version: 2016
Location: The Internet

Re: Ultimate Long TM1 quiz

Post by Emixam »

Code: Select all

['Dim Name':'Y'] = MAX(0, ['Dim Name':'X']);
ascheevel
Community Contributor
Posts: 304
Joined: Fri Feb 15, 2013 5:49 pm
OLAP Product: TM1
Version: PA 2.0.9.1
Excel Version: 365
Location: Minneapolis, USA

Re: Ultimate Long TM1 quiz

Post by ascheevel »

Nice!
User avatar
Elessar
Community Contributor
Posts: 401
Joined: Mon Nov 21, 2011 12:33 pm
OLAP Product: PA 2
Version: 2.0.9
Excel Version: 2016
Contact:

Re: Ultimate Long TM1 quiz

Post by Elessar »

Agree, nice catch!

I doubt somebody can make anything better, so here is a side exercise while we are waiting for Friday: can we rewrite such rule without IF and MAX/MIN?
Last edited by Elessar on Wed Nov 06, 2024 9:05 am, edited 1 time in total.
Best regards, Alexander Dvoynev

TM1 and Data Science blog: 7th article - Development requirements.
Adam
Posts: 118
Joined: Wed Apr 03, 2019 12:10 am
OLAP Product: IBM PA
Version: 2.0.9.x
Excel Version: Microsoft 365 x64

Re: Ultimate Long TM1 quiz

Post by Adam »

What about adding Hier Name and N: with C: only if relevant?

Code: Select all

['Dim Name':'Hier Name':'Y'] = N: MAX(0, ['Dim Name':'Hier Name':'X']);
Elessar wrote: Wed Oct 30, 2024 11:19 am can we rewrite such rule without IF and MAX/MIN?
For sake of readability I’m going to leave out the DimName/HierName/N:/C:

Code: Select all

['Y'] = (['X'] + ABS(['X'])) / 2;
I wound NOT use this in production because MAX approach is much more legible.
I've started blogging about TM1, check it out: www.havaslabs.com

Take care,
Adam
MarenC
Regular Participant
Posts: 405
Joined: Sat Jun 08, 2019 9:55 am
OLAP Product: Planning Analytics
Version: Planning Analytics 2.0
Excel Version: Excel 2016

Re: Ultimate Long TM1 quiz

Post by MarenC »

How optimised are these alternative solutions, what does the empirical evidence show?
Emixam
Regular Participant
Posts: 151
Joined: Tue May 21, 2019 3:33 pm
OLAP Product: TM1
Version: PA 2.0.x
Excel Version: 2016
Location: The Internet

Re: Ultimate Long TM1 quiz

Post by Emixam »

MarenC wrote: Wed Oct 30, 2024 1:47 pm How optimised are these alternative solutions, what does the empirical evidence show?
As per Cubewise, including the dimension reference is faster because this constrains the element search to a single dimension instead of searching over all dimensions.

https://code.cubewise.com/blog/7-tips-t ... ics-rules/
Last edited by Emixam on Wed Oct 30, 2024 2:01 pm, edited 1 time in total.
User avatar
gtonkin
MVP
Posts: 1235
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: Ultimate Long TM1 quiz

Post by gtonkin »

I would go one step further and fully qualify everything i.e. dim:hier:member
BR, George.

Learn something new: MDX Views
User avatar
Elessar
Community Contributor
Posts: 401
Joined: Mon Nov 21, 2011 12:33 pm
OLAP Product: PA 2
Version: 2.0.9
Excel Version: 2016
Contact:

Re: Ultimate Long TM1 quiz

Post by Elessar »

Correct answer:
It's hard to decide!
Emixam's answer was a really good catch. This dim:element optimization was measured and described by Cubewise. I have not measured if dim:hier:element is faster than dim:element. So, Adam, if you can prove this, you will also get a point also.

For the "MAX vs IF": I've realized recently that I've measured this long ago in 9.5.2, and MAX was much faster than IF expression in this case. I cannot guarantee this in PA, so it would be nice if somebody measures this. Anyway, you should avoid IFs in TM1 in any case.

Winner of this round is Emixam!

Question #44:
What are the differences between this methods of data clear?
  • ViewZeroOut (view covering the whole cube)
  • CubeClearData
  • CubeDestroy+CubeCreate
Best regards, Alexander Dvoynev

TM1 and Data Science blog: 7th article - Development requirements.
MarenC
Regular Participant
Posts: 405
Joined: Sat Jun 08, 2019 9:55 am
OLAP Product: Planning Analytics
Version: Planning Analytics 2.0
Excel Version: Excel 2016

Re: Ultimate Long TM1 quiz

Post by MarenC »

Anyway, you should avoid IFs in TM1 in any case.
This is a joke right?
Adam
Posts: 118
Joined: Wed Apr 03, 2019 12:10 am
OLAP Product: IBM PA
Version: 2.0.9.x
Excel Version: Microsoft 365 x64

Re: Ultimate Long TM1 quiz

Post by Adam »

MarenC wrote: Mon Nov 04, 2024 8:47 am This is a joke right?
I didn’t take it as a joke. When it’s possible to construct your TM1 DB so it doesn’t use/uses less IF statements, it will be faster. Sometimes it’s not possible and you deal with the consequences. Often times it’s trivial, but it might add up. Not something that I typically worry about myself.
I've started blogging about TM1, check it out: www.havaslabs.com

Take care,
Adam
MarenC
Regular Participant
Posts: 405
Joined: Sat Jun 08, 2019 9:55 am
OLAP Product: Planning Analytics
Version: Planning Analytics 2.0
Excel Version: Excel 2016

Re: Ultimate Long TM1 quiz

Post by MarenC »

I would like to bet there isn't a model out there that doesn't use an if somewhere, be it a TI or a rule.
User avatar
Elessar
Community Contributor
Posts: 401
Joined: Mon Nov 21, 2011 12:33 pm
OLAP Product: PA 2
Version: 2.0.9
Excel Version: 2016
Contact:

Re: Ultimate Long TM1 quiz

Post by Elessar »

Of course, you cannot avoid all IFs. But you should minimize them.

As an example:

Code: Select all

['A'] = N: IF(!Country @= 'Klingon Empire', ['B'], ['C']);
vs

Code: Select all

['A', 'Country':'Klingon Empire'] = N: ['B'];
['A'] = N: ['C'];
Best regards, Alexander Dvoynev

TM1 and Data Science blog: 7th article - Development requirements.
Post Reply