Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

deepaktibhe
Valued Contributor

If statement vs set analysis


Hello All,

Can you please tell me difference between if statement and set analysis in qlikview.

thanks,

5 Replies

Re: If statement vs set analysis

The most important difference is that set analysis is more quick expecially with complex expressions;

When you write a condition this is more compact and easy to read and to change in future

MVP
MVP

Re: If statement vs set analysis

Performance wise set is more efficient than if...

Re: If statement vs set analysis

Set analysis is basically building a filter into an aggregation function. The two following expressions should evaluate to the same:

     Sum({$<Product={'X'}>} Amount)

     Sum(If(Product='X', Amount))


Set analysis is always faster. However, Set Analysis is like a selection that is applied before the aggregation. It cannot have different conditions on different lines in the aggregation. In such a case you need an If().


HIC

Not applicable

Re: If statement vs set analysis

can you please explain a little bit more on how set analysis is applied before the aggregation and the inhability of having different conditions on different lines? Maybe an example too

qv_testing
Valued Contributor II

Re: If statement vs set analysis

The SET expression selection is done once for the whole chart.  SET version would peform must faster.

The IF() evaluates for every row of data.