Page 1 of 1

TI process to fill element in cube with 1's

Posted: Fri Nov 25, 2011 9:15 am
by kudzis
Hello,

I want to fill a specific measure in cube with 1's. I can do this with rule ['My measure'] = N: 1; however, this rule will not work with feeders.
I can fill 1's with spreading (data spread > repeat leaves), but I don't want to do this manually every time when I zero out cube before loading data.
I figured that TI process will be the best choice. Could you please give me a basic example how to do this?

Re: TI process to fill element in cube with 1's

Posted: Fri Nov 25, 2011 10:41 am
by qml
A couple of questions.

What do you need this "measure" for?
Why would you want to feed this rule (do you need this measure to consolidate)?

Also, you can feed this rule, but it would have to be from a cell that is certain to have a value at all times.

Depending on what you need this for it might be a good solution to have this rule-based and not feed it. It would keep the memory usage to a minimum.

TI would also be possible and really easy to write (hint: think what your data source would be).

Re: TI process to fill element in cube with 1's

Posted: Sat Nov 26, 2011 7:20 am
by vinnusea
Hi,
You can write TI process with while loops ,looping through all the elements in dimensions and populate 1's in all cube intersections and run process manually or in chores based on your requirement.

Re: TI process to fill element in cube with 1's

Posted: Sat Nov 26, 2011 4:16 pm
by David Usherwood
Wouldn't it be easier to create a view with the cells to which you wish to write your 1s, then cellputn(1,... to each of them?
Not that I'm convinced that writing 1s all over a cube is a sensible design though.

Re: TI process to fill element in cube with 1's

Posted: Sat Nov 26, 2011 4:27 pm
by qml
David Usherwood wrote:Wouldn't it be easier to create a view with the cells to which you wish to write your 1s, then cellputn(1,... to each of them?
Second that.
David Usherwood wrote:Not that I'm convinced that writing 1s all over a cube is a sensible design though.
And that as well.

Re: TI process to fill element in cube with 1's

Posted: Sun Nov 27, 2011 11:58 pm
by tomok
David Usherwood wrote:Not that I'm convinced that writing 1s all over a cube is a sensible design though.
Depends on what you are using it for. I have employed this method to use as a feeder when there was simply no way to use any other data in the model with which to write an effective feeder. When I say effective, I mean one that isn't either ridiculously complicated or overfeeds. In these type situations I'll post a value of 1 to a dummy measure (usually called feeder_flag) for all combinations in the cube that need feeding and which I was not able to come up with a better way to feed. As long as I keep the feeder_Flag element populated appropriately it works great.

Re: TI process to fill element in cube with 1's

Posted: Mon Nov 28, 2011 12:39 am
by Gregor Koch
Agree with tomok, there are definitely situations where it is helpful to use this approach.

Re: TI process to fill element in cube with 1's

Posted: Mon Nov 28, 2011 8:35 am
by Andy Key
tomok wrote:I'll post a value of 1 ... for all combinations in the cube that need feeding
is a different scenario to
kudzis wrote:['My measure'] = N: 1;
Feeder flags in explicit combinations make sense, 1 in all combinations - depending on the purpose - possibly needs a design rethink.

Re: TI process to fill element in cube with 1's

Posted: Mon Nov 28, 2011 10:05 am
by qml
Guys, I don't think we have enough material for this argument to go on. The OP hasn't explained what he needs this for, so it could either be a good idea, or a bad one. Either way, there are a few ideas for the OP to go with in this thread.

Re: TI process to fill element in cube with 1's

Posted: Wed Nov 30, 2011 3:34 pm
by kudzis
Hello,

sorry for a late reply and thank you everyone for your ideas and contributions to my problem.

I've solved my filling problem by creating a view as a source (selected only my 'dummy' measure and unchecked "skip zero/blank values"), then created a numeric variable (formula: variable = 1;), set contents to "data" and loaded everything into a cube.

Now for the need to do this. How can I feed this rule without using my 'dummy' measure:

['Parduodama šiluminė energija' ] = N: IF(DB('ag AG Informacija', !Versijos, !ag Tekstas, !ag AG, 'Parduodama šiluminė energija (taip/ne)')@='Taip',1,2);

Re: TI process to fill element in cube with 1's

Posted: Wed Nov 30, 2011 3:57 pm
by qml
Do you need values calculated by this rule to consolidate? Maybe you can use a rule that would work for all elements (no "N:" quantifier) instead? If you really need it to consolidate normally (and therefore must feed it), all you need to have is one cell with a non-zero input value (it can be anywhere, even in a different cube) and you can feed from it to the top consolidations across your dimensions (feeding all their children). You do not need multiple cells filled with ones to feed this rule.

Re: TI process to fill element in cube with 1's

Posted: Wed Nov 30, 2011 4:06 pm
by kudzis
qml wrote:Do you need values calculated by this rule to consolidate?
No, but I need this measure as an intermediate step to calculate another measure, which needs to consolidate. Feeding the top elements would be a good idea though - I should give it a try.

Re: TI process to fill element in cube with 1's

Posted: Wed Nov 30, 2011 4:33 pm
by qml
kudzis wrote:No, but I need this measure as an intermediate step to calculate another measure, which needs to consolidate.
In which case you do not need to feed this intermediate measure at all. You just need to feed the final measure.

Re: TI process to fill element in cube with 1's

Posted: Thu Dec 01, 2011 1:06 pm
by kudzis
qml wrote:
kudzis wrote:No, but I need this measure as an intermediate step to calculate another measure, which needs to consolidate.
In which case you do not need to feed this intermediate measure at all. You just need to feed the final measure.
Ok, I did some testing and that's what I found out ('dummy' measure is filled with 1's):

Let's say I'm feeding rule ['Final measure'] = N: ['a'] + ['b'];

Feeder ['dummy'] => ['Final measure'] works fine;
Feeder [{'a','b'}] => ['Final measure'] is not working because 'a' and 'b' are calculated and not feeded properly.

So that's why I thought I needed to feed all intermediate measures.

Re: TI process to fill element in cube with 1's

Posted: Thu Dec 01, 2011 1:07 pm
by kudzis
kudzis wrote:
qml wrote:
kudzis wrote:No, but I need this measure as an intermediate step to calculate another measure, which needs to consolidate.
In which case you do not need to feed this intermediate measure at all. You just need to feed the final measure.
Ok, I did some testing and that's what I found out ('dummy' measure is filled with 1's):

Let's say I'm feeding rule ['Final measure'] = N: ['a'] + ['b'];

Feeder ['dummy'] => ['Final measure'] works fine;
Feeder [{'a','b'}] => ['Final measure'] is not working because 'a' and 'b' are calculated and not feeded properly.

So that's why I thought I needed to feed all intermediate measures.
Completely offtopic: qml, your avatar is from Grim Fandango?

Re: TI process to fill element in cube with 1's

Posted: Thu Dec 01, 2011 1:18 pm
by qml
kudzis wrote:Feeder [{'a','b'}] => ['Final measure'] is not working because 'a' and 'b' are calculated and not feeded properly.

So that's why I thought I needed to feed all intermediate measures.
You do not have to feed your final measure from your intermediate calculated measures. Just think about which input values cause the final measure to be zero or-non-zero. In some cases this might be impossible to establish and so you might have to feed in a way that is totally detached from the actual calculation path.

Sometimes to avoid overfeeding it's a good idea to create some elaborate objects just to get the most optimal feeder. I'm not saying in your case that's the best option (as I don't know what exactly you're trying to do), but as a general rule it's always better to minimise those feeders that are not needed for anything.

PS: Yes, well spotted, my avatar is Manny from Grim Fandango.

Re: TI process to fill element in cube with 1's

Posted: Thu Dec 01, 2011 10:57 pm
by tomok
I’ll give you my dog peeing on a bush example to help you understand. Let’s imagine there is a street in your neighborhood (a cube) that has a lot of bushes (cell intersections) on it. It’s Easter and you are going to have an Easter egg hunt for the kids. You send out a bunch of parents to hide Easters eggs in the bushes. Unfortunately, after they’ve all been hidden, you realize you don’t know how many actual eggs there are out there and this is something you really need to know (a consolidation). We also know that dogs have the unique ability to sniff out eggs and can be trained to pee on every bush that has an egg(s) (a feeder) hidden underneath it. Finally, you also have a robot (the TM1 consolidation engine) that can count eggs and has the unique ability to smell dog urine (a feeder).

So, we send out the neighborhood dogs to sniff out eggs and pee on the bushes. It doesn’t matter which dog pees on the bush, just as long as all the bushes with eggs get peed on. We unleash the robot, which stops only at the bushes with dog urine, and counts the eggs under the bush. So, the moral of the story is that a feeder is nothing more than a marker on a cell intersection so that the TM1 consolidation knows not to skip it when counting values and it doesn't matter where the marker comes from or whether it actually has any relation to the intersection being marked (although it usually does about 99% of the time).

Re: TI process to fill element in cube with 1's

Posted: Fri Dec 02, 2011 7:56 am
by kudzis
That is a very nice example Tomok, thank you :)

Re: TI process to fill element in cube with 1's

Posted: Fri Dec 02, 2011 8:01 am
by Andy Key
tomok wrote:So, the moral of the story is that a feeder is nothing more than a marker on a cell intersection so that the TM1 consolidation knows not to skip it when counting values and it doesn't matter where the marker comes from or whether it actually has any relation to the intersection being marked (although it usually does about 99% of the time).
Really? I would have said that the moral of the story is Don't eat easter eggs that you find under bushes...