Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set expression for if-condition

Hi All,

I have to write a set expression for the following condition.

I need to count the distributor Id if the sd_verify_max_date is less than the currently selected month and year.

If only(Year) > Year(sd_verify_max_date)) and if((only(Year) = Year(sd_verify_max_date) and only(Month) >= Month(sd_verify_max_date) then count of distributor Id.

Please reply.

6 Replies
Luis_Cortizo
Employee
Employee

Hi, Rahul

   You would need to test but it would something like:

count({<sd_verify_max_data ={"<$(=Only(Year))"}>}distributor_id)

That should work

Hope it helps.

Best regards.

alexandros17
Partner - Champion III
Partner - Champion III

Count({$ <Year={'>=$(=Year(getfieldselection(sd_verify_max_date)))'}, Month={'>=$(=Month(getfieldselection(sd_verify_max_date)))'}>} distributor_Id)


Let me know

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Assuming sd_verify_max_date is a date field (not strings) then something like this:

count({<sd_verify_max_date ={'<$(=makedate(max(Year),max(Month)))'}>} DistributorID)


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Alessandro,

The expression value is not changing for different selection of month and year.

alexandros17
Partner - Champion III
Partner - Champion III

Let me know the format for sd_verify_max_date, is it a date?

Not applicable
Author

Yes the sd_verify_max_date is in Date format. And one more issue is that the combination of Year and Month both needs to be considered else it is taking month separately, i.e. 2014 march  is considered >= only till 2013 march...months after that are not taken into consideration. So it should be like if selected year is greater than the year of sd_verify_date than only year should be considered and if selected year is equal to the year of sd_verify_date than both year and month should be considered.