Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
tresesco
MVP
MVP

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

tamilarasu
Champion
Champion

Hi,

Try,

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

sunny_talwar

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.

Colin-Albert

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.

sunny_talwar

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