5 Replies Latest reply on Jul 23, 2018 7:20 AM by Stephen Groff

# Fix this IF/THEN Statement

It's Monday... apparently I got too much sun this weekend.

What is wrong with this IF/THEN statement

Gives me an ERROR at the "ELSEIF" point of the calculation.

Thanks!

• ###### 1. Re: Fix this IF/THEN Statement

Hi Stephen,

Syntax of multiple elseif statement is : IF <expr> THEN <then> [ELSEIF <expr2> THEN <then2>...] [ELSE <else>] END

try below logic:

if [Parameters].[Date]="Today" AND [Date] =TODAY() then 1

ELSEIF [Parameters].[Date]="Custom Date" and [Date]>=[Start Date] and [Date]<=[End Date] then 1 ELSE 0 END

You can refer below link for syntax explanation:

1 of 1 people found this helpful
• ###### 2. Re: Fix this IF/THEN Statement

Hi, Stephen

Hope this helps

ZZ

1 of 1 people found this helpful
• ###### 3. Re: Fix this IF/THEN Statement

Hi Stephen you are missing an end

if parameter.today = "Today"

then

(if date=today() then 1 else 0 end)

elseif parameters.date="Custom Date" then

(if date > = start date and date <= end date then 1 else 0 end)

else 1

end

Hope this helps kindly mark this answer as correct or helpful so that it willl help others

1 of 1 people found this helpful
• ###### 4. Re: Fix this IF/THEN Statement

You have a number of IFs with only a single END.

If I'm reading your calculation correctly you need to add "END" to your nested IF clauses, so you need an "END" after line 2 to end the 2nd line IF, and an "END" after line 4 to end the 4th line IF

1 of 1 people found this helpful
• ###### 5. Re: Fix this IF/THEN Statement

Hello Everyone,

Thank you for fixing this brain aneurysm I was having this morning.  All are correct answers, and while I wish I could select all as correct, I just chose the first respondent.

Many thanks to you all!

1 of 1 people found this helpful