Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

IF Vs Set Analysis

hi,

Can anyone please say me the difference between IF statement and set analysis

Is it possible to use IF statement instead of set analysis? if it is please explain me

Thanks in advance

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi Logesh,

We can use both If and Set Analysis expression, but when compared the Set Analysis has upper hand by performance and ease of usability.  If you have many conditions then you have use many if else and logical operators but in set analysis it is very very simple.

Using If() will have performance issues, since we need to evaluate row wise.

Set Analysis has some good features like P() and E(), which is not possible with If easily.

Hope this helps you.

Regards,

Jagan.

View solution in original post

6 Replies
sundarakumar
Specialist II
Specialist II

You can very well use If instead of Set analysis. But the performance will be better if you use set analysis, where as it will be impacted while using if statements.

Creating a flag in the balck end and using it in set analysis is always preferable.

-Sundar

tresesco
MVP
MVP

vardhancse
Specialist III
Specialist III

Both If and Set Analysis are one kind of functions.

The only difference is that by using set analysis, we can increase the performance.

sundarakumar
Specialist II
Specialist II

Because set analysis made on numeric fields yield better performance when compated to set analysis made on text

1. sum({<Country={'India','Chine'}>}sales)

2. sum({<country_check_flag={1}>}sales)

       2 performs best when compated to 1

-Sundar

jagan
Luminary Alumni
Luminary Alumni

Hi Logesh,

We can use both If and Set Analysis expression, but when compared the Set Analysis has upper hand by performance and ease of usability.  If you have many conditions then you have use many if else and logical operators but in set analysis it is very very simple.

Using If() will have performance issues, since we need to evaluate row wise.

Set Analysis has some good features like P() and E(), which is not possible with If easily.

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

Thanks for your replies...very useful