4 Replies Latest reply on Mar 12, 2017 10:33 PM by cody hoes

# Filter for either of two dimensions?

I'm very new to Tableau and I'm a bit stuck with what might be a simple problem. I'm trying to create a filter that can sort through two dimensions.  It's easier to illustrate with an example...

So the table below shows a list of students who could choose a favorite color, and a second favorite color if they wanted. I want to make a filter that can single out all students that like a specific color, whether it is their first or second favorite color.

I hope this makes sense, any help would be appreciated!

• ###### 1. Re: Filter for either of two dimensions?

Hi Cody,

Not sure but find my approach as reference below and stored in attached workbook version 9.3 located in the original thread

1. Count First: {fixed [First Favorite Color]:sum([Number of Records])}

2. Count Second: {fixed [Second Favorite Color]:sum([Number of Records])}

3. show??: ([Count First ]>1 and [First Favorite Color]<>"none") and  ([Count Second]>1 and [Second Favorite Color]<>"none")

Regards,

Norbert

• ###### 2. Re: Filter for either of two dimensions?

Hi Norbert,

Thanks for the response, but this wasn't what I was looking to do. I want a filter where I would be able to select a specific color, and the filter would show only those students that had selected that color as their first or second favorite color. So for example I could select "Red" on the filter, and it would only show Alice, Claire, Elizabeth, and Hank.  I really appreciate the response and I hope this makes sense.

Cheers,

Cody

• ###### 3. Re: Filter for either of two dimensions?

Hi,

one way to achieve this using parameters:

1.  Create a parameter ('P_Color'), type as String, Allowable values as List of Values (various colors).

2.  Create a calculated field ('Flag'), logic :

IF ([P_Color]=[First Favorite Color] OR [P_Color]=[Second Favorite Color]) THEN 'True'

ELSE 'False' END

3. Drag Flag to filter and select True value.

4.  Show parameter control.

1 of 1 people found this helpful
• ###### 4. Re: Filter for either of two dimensions?

Hi Sunil,

This is exactly what I was looking for, thank you so much.

Cheers,

Cody