Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

siewmei_lsm
New Contributor II

How to write set analysis for IF function?

I had set expression for IF function. How can i convert it to set analysis?

example:

If(ONTARGET_LATEST_SNAPSHOT='Y', sum(SALES_EOQ/2000), if(ONTARGET_LATEST_SNAPSHOT='N', sum(SALES_EOQ/1000)))

1 Solution

Accepted Solutions
MVP
MVP

Re: How to write set analysis for IF function?

Suggesting a correct set expression requires to know a minimum about your model, e.g. how the fields are linked or not linked, and the context of usage of your expression. I am missing both information in your posting.

Maybe just use

=

sum(SALES_EOQ)

/

Pick(Match(ONTARGET_LATEST_SNAPSHOT,'Y','N'), 2000,1000)

3 Replies
MVP
MVP

Re: How to write set analysis for IF function?

May be this

Sum({<ONTARGET_LATEST_SNAPSHOT = {'Y'}>}SALES_EOQ/2000) +

Sum({<ONTARGET_LATEST_SNAPSHOT = {'N'}>}SALES_EOQ/1000)

galax_allu
Valued Contributor

Re: How to write set analysis for IF function?

sum({<ONTARGET_LATEST_SNAPSHOT="Y"}>SALES_EOQ)/2000

sum({<ONTARGET_LATEST_SNAPSHOT="N"}>SALES_EOQ)/1000

MVP
MVP

Re: How to write set analysis for IF function?

Suggesting a correct set expression requires to know a minimum about your model, e.g. how the fields are linked or not linked, and the context of usage of your expression. I am missing both information in your posting.

Maybe just use

=

sum(SALES_EOQ)

/

Pick(Match(ONTARGET_LATEST_SNAPSHOT,'Y','N'), 2000,1000)