Page 9 of 11
Re: Ultimate Long TM1 quiz
Posted: Sat Oct 12, 2024 1:06 pm
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.
Re: Ultimate Long TM1 quiz
Posted: Fri Oct 18, 2024 5:51 pm
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?
Re: Ultimate Long TM1 quiz
Posted: Mon Oct 21, 2024 12:40 pm
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.
Re: Ultimate Long TM1 quiz
Posted: Mon Oct 21, 2024 1:38 pm
by Elessar
Which out-of-the-box encryption do you mean?
Re: Ultimate Long TM1 quiz
Posted: Fri Oct 25, 2024 3:02 pm
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']);
Re: Ultimate Long TM1 quiz
Posted: Fri Oct 25, 2024 3:09 pm
by ascheevel
Re: Ultimate Long TM1 quiz
Posted: Fri Oct 25, 2024 3:56 pm
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
Re: Ultimate Long TM1 quiz
Posted: Mon Oct 28, 2024 6:14 pm
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.
Re: Ultimate Long TM1 quiz
Posted: Tue Oct 29, 2024 7:34 pm
by Emixam
Code: Select all
['Dim Name':'Y'] = MAX(0, ['Dim Name':'X']);
Re: Ultimate Long TM1 quiz
Posted: Wed Oct 30, 2024 1:06 am
by ascheevel
Nice!
Re: Ultimate Long TM1 quiz
Posted: Wed Oct 30, 2024 11:19 am
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?
Re: Ultimate Long TM1 quiz
Posted: Wed Oct 30, 2024 12:01 pm
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:
I wound NOT use this in production because MAX approach is much more legible.
Re: Ultimate Long TM1 quiz
Posted: Wed Oct 30, 2024 1:47 pm
by MarenC
How optimised are these alternative solutions, what does the empirical evidence show?
Re: Ultimate Long TM1 quiz
Posted: Wed Oct 30, 2024 1:55 pm
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/
Re: Ultimate Long TM1 quiz
Posted: Wed Oct 30, 2024 2:00 pm
by gtonkin
I would go one step further and fully qualify everything i.e. dim:hier:member
Re: Ultimate Long TM1 quiz
Posted: Fri Nov 01, 2024 7:00 pm
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
Re: Ultimate Long TM1 quiz
Posted: Mon Nov 04, 2024 8:47 am
by MarenC
Anyway, you should avoid IFs in TM1 in any case.
This is a joke right?
Re: Ultimate Long TM1 quiz
Posted: Mon Nov 04, 2024 12:00 pm
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.
Re: Ultimate Long TM1 quiz
Posted: Mon Nov 04, 2024 2:52 pm
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.
Re: Ultimate Long TM1 quiz
Posted: Tue Nov 05, 2024 12:39 pm
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'];