1 Reply Latest reply on Feb 29, 2016 8:43 AM by Dan Sanchez

# How do you add Sub-category groups to Hierarchy?

Tableau community,

This question that has been stumping me all morning:

"Analyzing the product sub-categories: if it has a total profit of \$30,000 or greater, it is ‘Exceptional’; between 15,000 and 30,000 is ‘Good’; and less than that is ‘Poor’.  How many sub-categories are in our ‘Good’ bucket? Please display ‘Exceptional’, ‘Good’, and ‘Poor’ on the chart, differentiated by colors of your choice."

As you can see in the attached table, I have been able to sort out the sub-categories by Sum(Profit).  I have added groups for the 3 groups (Exceptional/Good/Bad profit) in the dimensions plane, but can't figure out how to accurately add it to the hierarchy so that I can display the 3 groups on the worksheet.  I feel this should be easy to do, but can't figure it out!  Any ideas on how I can accomplish this?  Thanks in advance for your help!

-Kevin

• ###### 1. Re: How do you add Sub-category groups to Hierarchy?

Hi Kevin!

We can use an LOD calc to create the buckets which will replicate the results at the row level.  This allows the calc to be a Dimension which we can drag into the hierarchy.

I created a calc called [Sub-Cat Buckets] using this formula:

IF { fixed [Sub-Category] : SUM([Profit]) } >= 30000

THEN 'Exception'

ELSEIF { fixed [Sub-Category] : SUM([Profit]) } >= 15000

THEN 'Good'

ELSE 'Poor'

END

I then dragged the new calc onto the viz to the left of [Sub-Category]:

Hope this helps! Thanks