5 Replies Latest reply: Aug 30, 2016 8:21 AM by Sunny Talwar

# 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.

• ###### Re: How to set multiple conditions criteria within functions Max, Min, Count

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)

• ###### Re: How to set multiple conditions criteria within functions Max, Min, Count

Thanks a lot!

• ###### Re: How to set multiple conditions criteria within functions Max, Min, Count

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

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

• ###### Re: How to set multiple conditions criteria within functions Max, Min, Count

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)