5 Replies Latest reply on Nov 30, 2016 10:09 AM by Srinidhi Narayan

# Tableau question

I am trying to create a 1/0 type condition...can somebody please tell me what is wrong with the below used logical equation,It's giving me an error

IIf((ZN(CNTD([MeditechPatientCaseID])) - LOOKUP(ZN(CNTD([MeditechPatientCaseID]-1)) / ABS(LOOKUP(ZN(CNTD([MeditechPatientCaseID])), -1))>0,1,0)

• ###### 1. Re: Tableau question

What error is it giving you?

• ###### 2. Re: Tableau question

It says unexpected closing parenthesis for the expression starting at character 5.

• ###### 3. Re: Tableau question

the formulas first part contains 2 closing parenthesis... double check your parens..

also, when posting a questions on the forum, try to be specific in your Subject area... "formula error on logical calculation"

or something specific like that, it helps when people try and search for similar problems or in answering the question.

• ###### 4. Re: Tableau question

Yep, I agree with Jon, you just need to check your parentheses. Probably missing one at the end or somewhere in the middle.

• ###### 5. Re: Tableau question

At the very least, you are definitely missing closing parens.. I see 11 opening parenthesis, but only 9 closing parens.  They should be paired equally.

My guess is you are missing one that closes the first ZN function, and one that closes the first lookup function.   However, not exactly sure if your numerator is both the first two factors (ZN - Lookup), or only the second factor (LOOKUP), you may want to look at that.  The way I read it, it looks like IIF( (A - B/ C) > 0, 1, 0), or should it be IIF( ( (A - B) / C ) > 0, 1, 0) ?  In which case you may be missing one or more  entire pairs of parens.