6 Replies Latest reply on Feb 17, 2016 8:00 AM by Steve Martin

# Trying to simplify the If function .

Hi

I have below If function with multiple "OR" involved in calculation.

I was wondering if there anyway I could simplify the function?

Thank you

• ###### 1. Re: Trying to simplify the If function .

Hey Casey,

What you are looking for is an "IN" operator. There is an "idea" entry for it here: 'IN' Operator equivalent

There are a few workarounds in the thread; but nothing as nice as the IN operator.

Hope this helps!

- Derrick

1 of 1 people found this helpful
• ###### 2. Re: Trying to simplify the If function .

Do you have to write a calculation in this case?

It looks like you get [WO#] or Null. You could use a set instead which allows you to check boxes instead of writing calculations and then use the set in a single IF statement to get [WO#] for members in the set (that return TRUE).

• ###### 3. Re: Trying to simplify the If function .

Hi Derrick,

I been trying use  In operator .

But getting an error like below.

Could you please review my calculation.

I believe In operator is my solution.

• ###### 4. Re: Trying to simplify the If function .

Hi Derrick,

I been trying use  In operator .

But getting an error like below.

Could you please review my calculation.

I believe In operator is my solution.

• ###### 5. Re: Trying to simplify the If function .

The link that Derrick provided was an idea thread - meaning functionality that is NOT currently included in Tableau but users of the community would like to see added. With that said, I do not know if there is a simpler way to write your formula given that IN does not currently exist as a Tableau function.

1 of 1 people found this helpful
• ###### 6. Re: Trying to simplify the If function .

As a matter of interest, what do you hope to achieve by simplifying the calculation?

If your data-source is a database, are you able to write custom-sql? This would allow you to use the Exists SQL-function which will be fastest and more reliable than In, other than this, the alternative would be to consider changing your 'or' statements to 'EleseIf' instead though this is largely for providing a different result per instance.

Steve