Page 2 of 2

Re: consolidation multiplication

Posted: Tue Oct 11, 2011 8:19 pm
by Duncan P
Thanks Steve.

It occurred to me last night that this doesn't handle negative numbers at the leaf level. To do this you would need to take the absolute value and keep track of how many minus signs there were. Something like this :-

['isnegative'] = N:IF(0>['data'],1,0);
['iszero'] = N:IF(0=['data'],1,0);
['logarithm'] = N:LN(ABS(['data']));
['data'] = C:IF(0=['iszero'], EXP(['logarithm']) * (-1)^['isnegative'], 0 );

Re: consolidation multiplication

Posted: Tue Oct 11, 2011 10:25 pm
by Gregor Koch
:ugeek:

Nice one Duncan, thanks for sharing.

Doesn't quite work for me with negative values, as I always get a positive result, but still....

EDIT: Just forgot to feed ['isnegative'], works like a treat now.

Re: consolidation multiplication

Posted: Sun Feb 19, 2012 12:18 am
by jstrygner
Duncan, just another wow and thanks from me for sharing this (old post, but I just found your solution).

What is additionally very impressive here is that your example does not care if you have parallel hierarchies in your dimension (along which you want to multiply) or not - it just does what is wanted!

Re: consolidation multiplication

Posted: Sun Feb 19, 2012 12:51 pm
by Duncan P
I haven't tried it but it should work with hierarchy weights as well - but with the proviso that a 0 means ignore, a -1 means divide and any other means multiply by the leaf to the power of the weight, so a weight of 2 would mean multiply twice, and a weight of -1/2 would mean divide by the square root. I have no idea why you might need non 0, 1 weights but there you are.