Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
mwallman
Creator III
Creator III

What is generally faster in QlikVIew Sum(If...) or If(sum(..))?

Hi all,

Can anyone please tell me which expression would generally perform faster?

What is faster in QlikVIew Sum(If...) or If(sum(..))?

4 Replies
sunny_talwar

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

miguelbraga
Partner - Specialist III
Partner - Specialist III

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

nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

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

maxgro
MVP
MVP

you can read the difference between sum(if...) and if(sum...) here

Conditional Aggregations