Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Who knows how to calculate average of 2 or more variables in a script or an expression?
Thanks in advance,
I think you want to have a look at the rangeavg() function. Could be used like
LOAD
A,
B,
rangeavg(A,B) as Average
from ...
Or
rangeavg( $(vVal1), $(vVal2) )
Hope this helps,
Stefan
I think you want to have a look at the rangeavg() function. Could be used like
LOAD
A,
B,
rangeavg(A,B) as Average
from ...
Or
rangeavg( $(vVal1), $(vVal2) )
Hope this helps,
Stefan
You'are right.
I used rangeavg in an expression, didn't work.
Thanks,
Stefan,
How does the second method work?
Regards,
Well, it works using QV variables.
I wasn't sure what you mean with variables, since some people (like in statistics) use the term variable different from the QV usage, where it is used like in software programming (variable in contrast to constant). The term variable used in statistics would be called field or dimension / measure in QV.
Since I don't know what you are after, I posted short samples for both (maybe too short samples). So $(vVal1) and $(vVal2) evaluate the QV variables vVal1 and vVal2 respectively.
But if this does not solve your probelm, it would be more important to know what you are after, what your requirements / problems are?
Thanks,
I found out.
Hi, do you think it can be used to define the value of a reusable expression like that?
It does not work in Sense variable editor.
RangeAvg(
$(eKPI(06)), $(eKPI(07))
)
The values are monthly figures and their average should be calculated.
Thanks , Enikö
Hi, could anyone pls. resolve my question from some month ago, I found a workaround but this would be nicer:
RangeAvg(20, 40) is the definition or my variable in Qlik sense, it works
But with a nested expression it does not work, can anyone suggest pls why?
RangeAvg
$(ePDCA_WSAuslief_Pkd_Total(01)), $(ePDCA_WSAuslief_Pkd_Total(02))
)
Those 2 expressions are complicated enough... how could I pass their value to RangeAvg?????
Thanks a lot! Enikö