8 Replies Latest reply on Feb 15, 2017 1:43 PM by Simon Runc

# Condition by Filter - Group Dimensions for only 1 of the Filtered Options

Hi all!

I need to create a condition to a filter and I am not sure how to do it.

This is the scenario: I have a database of employee's training metrics.

Employees are divided by Organizations, and also by Location (city).

The way I need this to work is filtering only 1 organization at a time, and then display the number of training hours per location and category inside this organization.

I have achieved this using bar graphs, however one of the Organizations needs a specific setting to the Locations.

I need a way to inform Tableau that when I select this particular Organization (lets say "Org2"), the main Locations I need for this org are only 6 (Curitiba/Bangkok/Houston/Shanghai/Buenos Aires/Budapest) and all other locations need to get grouped together under a "Others" group. However, this needs to be grouped like this ONLY for this organization.

Is there a way to do this, and how?

I suspect it can be done with the Condition - By Formula filter, but I have no idea how to create this formula.

• ###### 1. Re: Condition by Filter - Group Dimensions for only 1 of the Filtered Options

hi Thalita,

This formula should do the trick...

I've worked it up using superstore, where [Segment] = 'Consumer' is your [Org] = 'Org 2' and then the States are your group.

IF [Segment] = 'Consumer' THEN

IF [State] = 'Alabama' or [State] = 'Arizona' or [State] = 'Arkansas' THEN [State] ELSE 'other' END

ELSE [State]

END

So it looks like this...

Hope that helps, but let me know if that doesn't do the trick.

1 of 1 people found this helpful
• ###### 2. Re: Condition by Filter - Group Dimensions for only 1 of the Filtered Options

Hi Simon,

Thanks a lot!

• ###### 3. Re: Condition by Filter - Group Dimensions for only 1 of the Filtered Options

Simon,

I am not sure I know where to use the formula though.

I thought it was on right-clicking my City filter and choosing the "Condition - By Formula" option, but when I try to use the formula (adjusted to my parameters) I get a message saying "The formula must be na aggregate calculation or reger only to this field".

What am I doing wrong?

• ###### 4. Re: Condition by Filter - Group Dimensions for only 1 of the Filtered Options

I'm not sure I understand...

So you need to create a new calculated field...with the formula in (switching out State and Segment for your fields). You'd then use this new field instead of City

I've attached an example...so if this isn't doing what you need, you can mock up your situational in this and post back (once we have a workbook, it'll be easier to see exactly what you want to do).

1 of 1 people found this helpful
• ###### 5. Re: Condition by Filter - Group Dimensions for only 1 of the Filtered Options

I got it, it is working perfectly now.

Thanks!

• ###### 6. Re: Condition by Filter - Group Dimensions for only 1 of the Filtered Options

Awesome!...it's always easier to see it live in a workbook!

1 of 1 people found this helpful
• ###### 7. Re: Condition by Filter - Group Dimensions for only 1 of the Filtered Options

Hi Simon, since you were already so helpful could you check my new post and see if you can pitch in?

It seems like a simples question but I've only found very complicated solutions for it so far.

Thanks!!!

• ###### 8. Re: Condition by Filter - Group Dimensions for only 1 of the Filtered Options

No probs...Although you can do some nice tables in Tableau, it takes a bit more time as it's not really optimized for tabular reporting. I've replied in the thread of one idea, so let me know (in that thread) if that works for you, and if not why...as there are always a few ways to do things in Tableau (all with their own pros and cons...just depends on the use-case which one is best!)

1 of 1 people found this helpful