4 Replies Latest reply: Jul 10, 2017 1:26 PM by Ruben Marin

# How many criteria can given using "And" logic in IF condition?

I have following script which is not working Properly as i have used three Conditions using "AND" .It works good when i use two condition with one "AND". Is there solution to for applying three criteria in IF condition?

if((Not IsNull("Customer Name Today") and Not IsNull("Customer Name Yesterday") and [Customer Name Today]=[Customer Name Yesterday]),'No Change',

if((Not IsNull("Customer Name Today") and Not IsNull("Customer Name Yesterday") and [Customer Name Today]<>[Customer Name Yesterday]),'Change',

Thanks

• ###### Re: How many criteria can given using "And" logic in IF condition?

Hi Moni, there should be no problem using many "ands", what it's happening and what's the expected result?

You can create a simple table to check the data and see what is happening:

Dimensions (check in both 'supress null values'):

- "Customer Name Today"

- "Customer Name Yesterday"

Expression:

If("Customer Name Today"="Customer Name Yesterday", 1, 0)

You can sort by expression to group them and follow the result of the conditionals.

• ###### Re: How many criteria can given using "And" logic in IF condition?

Hi,

This is my full formula. I need this Column should be used in the table. On using this formula it is not displaying 2nd and 3rd Condition alone.

if((IsNull("Customer New Today") and IsNull("Customer Old Yesterday")), 'No Change',

if((Not isNull("Customer New Today") and  Not IsNull("Customer Old Yesterday") and ([Customer New Today]=[Customer Old Yesterday])),'No Change',

if((Not isNull("Customer New Today") and  Not IsNull("Customer Old Yesterday") and ([Customer New Today]<>[Customer Old Yesterday])),'Change',

if((IsNull("Customer New" Today) and Not isNull("Customer Old Yesterday")),'Deletion',

if((not IsNull("Customer New Today") and IsNull("Customer Old Yesterday")),'Addition'))))) as [Customer LineType]

• ###### Re: How many criteria can given using "And" logic in IF condition?

Hi,

Below might be compact one to use.

 Customer New Today Customer Old Yesterday Result NULL NULL No Change ABC ABC No Change ABC ABCD Change NULL ABC Deletion ABC NULL Addition

Formula :-

IF((isNull([Customer New Today]) and isNull([Customer Old Yesterday])) or  [Customer New Today]=[Customer Old Yesterday],'No Change',

if(isNull([Customer New Today]),'Deletion',

'Changes'

)

)

)

Regards,

Ravi Balar

• ###### Re: How many criteria can given using "And" logic in IF condition?

The only typo I see is the double quotes on the 'Deletion' line:

- if((IsNull("Customer New" Today) and Not isNull("Customer Old Yesterday")),'Deletion',

Should be:

if((IsNull("Customer New Today") and Not isNull("Customer Old Yesterday")),'Deletion',

The expression posted by Ravi is more clean and easy to manage.