8 Replies Latest reply on Sep 20, 2016 10:51 AM by Liliya Fisher

# Need help with a formula

Hello,

I need help with modifying a formula. I need to combine a few when statements in the formula. One person is responsible for multiple Business groups so it needs to say when Business group is 'Service',  'Remaining TV' or 'Licenses' or 'Lifestyle Entertainment' or 'TV' then the person is Lyn Leblanc . In other cases one person is responsible for 1 Business group so there are no issues with display. This whole formula works as a user filter which states if Business group is this... then this person can see this...

Thank you

• ###### 1. Re: Need help with a formula

You should just create sets out of Business Group and name them after each corresponding person's name.

Your formula would then just be:

if [Bruce Grant] then 'Grant, Bruce'

elseif [Lyn Leblanc] then 'Leblanc, Lyn'

...

etc.

Edit: actually, this might not make sense if most folks correspond to only one business group.

• ###### 2. Re: Need help with a formula

Instead of specifiying the Business Groups for Lyn Leblanc could you just remove those and include them in 'Else Lyn Leblanc'?

• ###### 3. Re: Need help with a formula

Liliya,

Your case statement will evaluate exactly as you described it.

Doing

CASE [Fruit]

WHEN 'Apple' then 'Green'

WHEN 'Grapes' then 'Green'

WHEN 'Watermelon' then 'Green'

is exactly the same as doing

IF [Fruit] = 'Apple' or [Fruit] = 'Grapes' or Fruit = 'Watermelon' then Green ELSE....

It sounds like you're not getting the expected result in your data though so please upload a Tableau Packaged Workbook including some sample data to support the calculation so we can see where it does match.

• ###### 4. Re: Need help with a formula

There are other folks who map to multiple business groups

1 of 1 people found this helpful
• ###### 5. Re: Need help with a formula

Hi.

I'll need to replace Case by if statements then you can use logical operator(and/or) and combine conditions.

Depending on situation you can mix Case and If statements.

I'm not sure if i understood correctly but if you have only one person responsible for more than one Business Group you can let this one on Else statemente:

CASE [Categoria]

When 'a'  then 'd'

When '2' then 'a'

Else 'b'

End

1 of 1 people found this helpful
• ###### 6. Re: Need help with a formula

I don't think ELSE Lynn Blanc will work as there may be new Business groups coming each month so I need to specify the business groups.

1 of 1 people found this helpful
• ###### 7. Re: Need help with a formula

I think both Tom's IF solution or my set solution will take pretty much the same amount of time. I'm still not sure if what you're doing doesn't work or if you just need a condensed formula since when statements are not pretty.

1 of 1 people found this helpful
• ###### 8. Re: Need help with a formula

ok, thanks so much! I will try the suggestions.