6 Replies Latest reply on Nov 20, 2018 4:30 PM by Peter Fakan

# Having a field containing grouped/ungrouped values?

I have a field that contains the following values:

Under 5

7-12

Teen

50-65

Over 65

I would like to create a group that contains the following values:

Under 5

7-12

Teen

50-65

Over 65

Youth (Under 5 + 7-12 + Teen)

Senior (50-65 + Over 65)

How can this be done in Tableau?

• ###### 1. Re: Having a field containing grouped/ungrouped values?
• Self Union Your data Twice
• Write a Calculation
• Exclude Null and here it is:

\

Thanks

Deepak

If it Helps, Pl Mark it Helpful and CORRECT to close Thread

• ###### 2. Re: Having a field containing grouped/ungrouped values?

Is there any way to do it without unioning the data? I imagine it would screw up all my other calculations (sum, count, etc.)

• ###### 3. Re: Having a field containing grouped/ungrouped values?

Sorry..I am out of Ideas on this , but Have you tried the above and as You said your calculations went bad..I don't think so that happens.

• ###### 4. Re: Having a field containing grouped/ungrouped values?

Hi Rafael,

You could do this with sets, but you could only display one set at a time due to the conflicts (i.e. a person who is IN the 7-12 group is also IN the Youth group).

I'm still not 100% sure of your requirement though, wouldn't this be better arranged as a separate column in your data ?

HTH

Peter

• ###### 5. Re: Having a field containing grouped/ungrouped values?

Displaying one set at a time could be fine. How would I switch between different sets?

• ###### 6. Re: Having a field containing grouped/ungrouped values?

With a parameter and a zinger of a calculated field

if [Parameter] = 1 then [Set 1]

if [Parameter] = 2 then [Set 2]

end

HTH

Peter