Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Read about Qlik’s Response to COVID-19 Read the Letter, Join the Group.
Highlighted
Contributor II

Convert if condition to Set

Hi All,

I am having following if condition which needs to be converted into Set analysis

Count((if([DB DATE]>=$(Start_date) And (DB_DATE)<=$(End_date),[Instrument No])))

-Jay

5 Replies
Highlighted
MVP
MVP

Re: Convert if condition to Set

Count({<[DB DATE]={'>=$(Start_date) <=$(End_date)'}>} [Instrument No])

Highlighted

Re: Convert if condition to Set

Hi,

Try,

Count({<[DB DATE]={">=$(Start_date)<=$(End_date)"}>}[Instrument No])

Highlighted

Re: Convert if condition to Set

In addition to the below comments, I would also make sure that $(Start_date) and $(End_date) has same format as DB DATE for this to work. You can check this by adding ='>=' & $(Start_date) & '<=' & $(End_date) to a text box object to check if you get the date range you want in the same format as DB Date.

Highlighted

Re: Convert if condition to Set

If you add the set expression column with a blank label, you can see the evaluated set expression in the column label without needing to create an extra text box.

Highlighted

Re: Convert if condition to Set

Agreed Colin‌, but I usually use the text box approach because next step for me is to just copy the the whole text box expression and put it between dollar sign expansion ->  $(=TextBoxExpression).

In this case -> Count({<[DB DATE]={"$(='>=' & $(Start_date) & '<=' & $(End_date))"}>}[Instrument No])

You may not like my approach, but this gives the exact same result and make me feel like I am in control of what is going on

Best,

Sunny