Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Not applicable

Pick Match vs Nested If Performance

Hi, I am new to Qlikview and really getting into Qlikview after learning more and more most of which I did from Qlikview 11 for Developers and Cookbook('God Bless both books' Authors for making such a great effort and saving mine as well as other people's time! ). Can someone demonstrate the performance difference between pick(match()) combination and nested if() functions if possible both in script and front end side. Sample apps would be really appreciated. I have seen my senior's report and he has used lots of nested if conditions on front end expression of a pivot table(about 25-30 total if() approximately). I am learning from his apps so I think those if() should be replaced by pick match combination but only if they increase the performance significantly. I am asking this because I had read in QV 11 Dev Book that Pick function has a performance improvement over If.

Thanks in Advance,

Salman.

2 Replies
Highlighted
MVP
MVP

Re: Pick Match vs Nested If Performance

You can have a look at this discussion:

Why is using Pick and Match functions combination thought to be faster than nested IF statements?

IMHO, a pick() / match() combination is better readible and maintainable than a nested if() construct, that's why I prefer to use it, especially in the front end when doing the comparison on dimensional values (and here it often doesn't matter performance wise).

In the script, things might be different performance wise, so just run some tests yourself, with your data (there is some sample code in the thread I've linked above).

Hope this helps,

Stefan

Highlighted
MVP & Luminary
MVP & Luminary

Re: Pick Match vs Nested If Performance

I have never done a direct performance comparing from nested if-loops to pick(match()) functions but in my experience the differences are very big especially if the calculations within are quite heavily. The reason for it is quite obvious - within the pick(match()) you calculate the to comparing measure only once and within the if-loop it will be calculated again and again until the condition will be true - whereby I'm not really sure if this in qlikview is applied in this way (like in many other tools) then I have heard that qlikview had a different implementation and calculates at first all if-branches and compared afterwards which are true or false.

Beside them are if-loops limited to max. 99 nestings and like Stefan mentioned is the readability and maintainability from heavily nested constructions are quite bad.

Further you should check if some of these if's could be replaced by set analysis conditions which will also speed up a calculation enormously: A Primer on Set Analysis

- Marcus