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

IF statements on field in set analysis

hi all,

I am trying to do something with set analysis and have come across a problem.

I have the following issue:

I need to create a set where the field could change...  rather than the value.

so, for example:

=count({< if(primary_date = 0, secondary_date, primary_date) = {">=$(v_TargetDate)"} >} orders)

any help would be greatly appreciated!

thanks!

7 Replies
sunny_talwar

Not sure what you are trying to do? Can you expand by providing a sample?

Mark_Little
Luminary
Luminary

HI

Try

IF( Primary_Date = 0,

    count({< Secondary_date= {">=$(v_TargetDate)"} >} orders) ,

    count({< Primary_Date = {">=$(v_TargetDate)"} >} orders)

    )

Mark

Gysbert_Wassenaar

=count({< primary_date = {0}, secondary_date = {">=$(v_TargetDate)"} >+<primary_date = {'>0'}, pimary_date = {">=$(v_TargetDate)"} >} orders)


talk is cheap, supply exceeds demand
mclen_vj
Partner - Contributor
Partner - Contributor

To keep it salable, you can try this:

Var1 = if(primary_date = 0, 'secondary_date', 'primary_date')

Var2 = count( {<$1={">=$(v_TargetDate)"} >}   orders)

Execute as : =$(Variable2( Variable1 ))

Regards, VJ

anushree1
Specialist II
Specialist II

Hi ,

You could probably create a variable like v_date =if(primary_date = 0, secondary_date, primary_date)

and then use it in the set expression as below

=count({< v_date= {">=$(v_TargetDate)"} >} orders)

maxgro
MVP
MVP

you can also add a field in the script with the if condition

the set analysis will be easier on this new field

Not applicable
Author

Hope this helps.