Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Difference between IF and SET expression

Hi Guys,

Can some one explain if there is any difference between these two expressions? One is developed with IF logic and one with SET.

Expression with SET:

SUM ({<[IDEN PV 1WK] = {"$(vPVLastWeekHL1Combined)"}> *

$<[IDEN PV 4WKS] = {"$(vPVLast4WeeksHL1Combined)"}> *

$<[IDEN SM HPW 1WK] = {"$(vHPWLastWeekHL1Combined)"}> *

$<[IDEN SM HPW 4WKS] = {"$(vHPWLast4WeeksHL1Combined)"}> *

$<[MKT Email Received 12WKS Count] = {"$(vEmailReceivedLast12WeeksHL1Combined)"}>} [IDEN PV 1WK])

Expression with IF:

=If(Sum ([IDEN PV 1WK])$(vPVLastWeekHL1Combined) And

(Sum ([IDEN PV 4WKS])$(vPVLast4WeeksHL1Combined)And

(Sum ([IDEN SM HPW 1WK])$(vHPWLastWeekHL1Combined) And

(Sum ([IDEN SM HPW 4WKS])$(vHPWLast4WeeksHL1Combined)And

(Avg ([MKT Email Received 12WKS Count])$(vEmailReceivedLast12WeeksHL1Combined)))))

Sum ([IDEN PV 1WK]))

And which one will do fast calculation and generate report?

Please advise?

Thanks,

TA

3 Replies
Not applicable
Author

Hi,

Can some one please give some expert advise about above post?

Thanks,

TA

Not applicable
Author

Always use set analysis when possible. It is highly efficient compared to IF statements. There are situations where you need to use an IF statement, though. Thats really all you need to know as long as the above equations work for you.

Not applicable
Author

Thanks for you input.

But are these two expression same in terms of output?

Or I am missing something in set expression?

Please advise.

Thanks,

TA