Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Can anyone please tell me which expression would generally perform faster?
What is faster in QlikVIew Sum(If...) or If(sum(..))?
Well two of them will not always give the same result, so comparing them doesn't make whole lot of sense. May be the third option is the fastest: Using set analysis
Hey there,
I think its faster the Sum(If(...)) depending on what are the test made inside the If formula. Anyway I strongly advise you to use the If in a flag on the script like this:
If([your test], 1, 0) as Flag
And then multiply with the sum like this:
Sum([you expression]) * Falg
If you don't want to use the sum(if(...)) in script avoid it also in charts. Use instead set analysis. The best practices tells that Sum(If(....)) formulas have low performance when compared with Set Analysis and/or use of flags in script.
I'll search for more info at this matter
Best regards,
D.A. MB
Both will take same time.
instead use Set analysis
Exp:
Set Analysis : Sum({<Year={2015,2016}>}Sales)
Normal := If(year=2015) and Year=2016),
Sum(Sales)
)
I hope this may helps you......
-Nagarjun
you can read the difference between sum(if...) and if(sum...) here