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

How to set multiple conditions criteria within functions Max, Min, Count

I need to specify multiple conditions within max, min and count functions, for example:

If I have following Orders table:

Order     Type     Date   

0001         A        01/08/2014

0002         B        19/08/2015

0003         A         05/05/2016

0004         A         17/02/2014

0005         C         01/01/2014

0006         A         04/07/2013

Select the order of a certain type which its date is between a date range:

Min({$<[Type] = {'A'}; Date={'>=Min_Date,<Max_Date'}>} Order)

For example If my date range is [01/01/2014, 31/12/2017] the result for above table would be 0004

I want to specifiy the condition within Min function, no using if conditionals. I would like to know how can I indicate multiple conditions within Min, max and count functions.

But above expression is not working.

1 Solution

Accepted Solutions
sunny_talwar

Well you would need to use Dollar sign expansion to evaluate your functions within the set analysis modifier

Min({$<[Type] = {'A'}, Date={'>=$(=Min(field1))<$(=Max(field2))'}, Field_Name1 = {'Value1'}, ....>} Order)

View solution in original post

5 Replies
sunny_talwar

If it is an AND condition, all you need to do is to separate each condition with a comma

Min({$<[Type] = {'A'}, Date={'>=Min_Date<Max_Date'}, Field_Name1 = {'Value1'}, ....>} Order)

For OR condition within a single field, you can try this:

Min({$<[Type] = {'A', 'B'}>} Order)

For OR condition in two different field

Min({$<[Type1] = {'A'}>+<Type2 = {'A'}>} Order)

sunny_talwar

You can read more about set analysis in the attached document

Not applicable
Author

Thanks a lot!

Not applicable
Author

And things like nesting functions is possible? like below in bold:

Min({$<[Type] = {'A'}, Date={'>=Min(field1)<Max(field2)'}, Field_Name1 = {'Value1'}, ....>} Order)

sunny_talwar

Well you would need to use Dollar sign expansion to evaluate your functions within the set analysis modifier

Min({$<[Type] = {'A'}, Date={'>=$(=Min(field1))<$(=Max(field2))'}, Field_Name1 = {'Value1'}, ....>} Order)