Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Product of sequences in QlikView 11

Hi,

I have the need in a QlikView file of create a formula that multiplies all the values in a field.

That would be easily described as the product of sequences, yet in QlikView it seems to me that is not present a "product()" function.

I came across the solution already proposed in 2009 in another thread:

exp( sum( log( field ) ) )
I tried to apply this to my case but if use it in a Chart it looks like it isn't giving the correct order to the operands.
For example if I have a table:
DimensionValue
A1.3
A1.25
B1.5
B1.7
and I want to get:
A = 1.3 * 1.25 = 1.625
B = 1.5 * 1.7 = 2.55
the result is always 1 with the exp(sum(log())) expression.
The same result is given if I pass the value as a different field with log(Value) in the script.
If I write the "equivalent" expression: exp( log(1.3) + log(1.25 ) ) the result is 1.625
Has anybody got a hint on this?
Thank you
2 Replies
Gysbert_Wassenaar

Exp(sum(log(Value) works for me. Something like this should work in the script:

T1:

LOAD * INLINE [

    Dimension, Value

    A, 1.3

    A, 1.25

    B, 1.5

    B, 1.7

];

T2:

load Dimension, Evaluate(Concat(Value,'*')) as Product

Resident T1

group by Dimension;

See attached example.


talk is cheap, supply exceeds demand
Not applicable
Author

Yes, I suppose it could be worked around like that, still I'm confused with the Exp(Sum(Log(Value))) expression not working...