6 Replies Latest reply on Feb 25, 2019 11:16 AM by Amyl

# If statement with multiple conditions

Hi Team,

i am writing below mentioned if statement but i am not achieving all, i am missing  "2-7 Days" .

IF   DATEDIFF('day',[Ingestion Date],[max date])  > 29 THEN " 29 days"

ELSEIF DATEDIFF('day',[Ingestion Date],[max date])  > 16 and

DATEDIFF('day',[Ingestion Date],[max date])  < 29 THEN "15-28 Days"

ELSEIF DATEDIFF('day',[Ingestion Date],[max date])  >9 and

DATEDIFF('day',[Ingestion Date],[max date])  < 15 THEN "8-14 Days"

ELSEIF DATEDIFF('day',[Ingestion Date],[max date])  > 3 and

DATEDIFF('day',[Ingestion Date],[max date])  < 8  THEN "2-7 Days"

ELSE "0-1 Days "    END

Thank you

• ###### 1. Re: If statement with multiple conditions

You data table has no values in that range. The '2-7 days' bucket category will not be created because there are no rows of data for it to be applied to.

Here is the breakdown of the number of rows of data and the datediff value.

G

• ###### 2. Re: If statement with multiple conditions

Hi,

If there is no values i should get  zero '0'. can you please give me the logic according to that.

Thank you

1 of 1 people found this helpful
• ###### 3. Re: If statement with multiple conditions

I am sure there is someone else on the message board that can give a better answer but here is what I have done in the past in a similar situation.

G

1 of 1 people found this helpful
• ###### 4. Re: If statement with multiple conditions

Just add an ifnull clause to your calculated field to return a 0 if there is a null response;

IF (ifnull( DATEDIFF('day',[Ingestion Date],[max date])  > 29 THEN " 29 days"),0)

HTH

Peter

• ###### 5. Re: If statement with multiple conditions

Hi Can you please check this calculation,