8 Replies Latest reply on Sep 28, 2016 4:43 AM by Nicholas Sharaf

Slicing a column into three categories to display as a Histogram

Hi,

I have an aggregated column that represents a ratio which I have calculated earlier. This ratio is called 'Score'. I want to slice this column into three categories i.e. Underweight, Healthy and Overweight and represent that information in a histogram.

The conditions are as following:

Score >1.2 Then Overweight

Score < 0.8 Then Underweight

Else Healthy

Using my current logic written as the following:

IF ({FIXED [Name]:[Score]} < 0.8)

Then 'Underweight'

ELSEIF ({FIXED [Name]:[Score]} >1.2)

THEN 'Overweight'

ELSE'Healthy'END

With this calculate field, I am able to accurately distinguish by color the Names. However I am unable to aggregate this into a histogram. The desired out on the histogram is : Total Number of Overweight, Underweight and Healthy people.

• 1. Re: Slicing a column into three categories to display as a Histogram

Hi Nicholas,

Maybe this will help.

• 2. Re: Slicing a column into three categories to display as a Histogram

Hi Nicholas,

Just write a calculation:

IF [Score] < 0.8

Then 'Underweight'

ELSEIF [Score] >1.2

THEN 'Overweight'

ELSE 'Healthy'

END

Put this calculation on the Color mark.

Regards,

Kashish Chauhan

• 3. Re: Slicing a column into three categories to display as a Histogram

Hi Surendra,

It gives me this

I know for a fact that this is incorrect as there are 300 Underweight and 149 Over weight records. I'm using CountD function in rows because this information is time sensitive so multiple records of the same person appear on different dates.

I'm guessing that Tableau might be aggregating the Efficiency Score for the same Name due to which its always Overweight?

• 4. Re: Slicing a column into three categories to display as a Histogram

Hi Nicholas,

If you can send me a sample workbook I can take a look at it.

• 5. Re: Slicing a column into three categories to display as a Histogram

Hi Nicholas,

seems like you are right

please try to sum and check the results

if sum([Efficiency Score]) < 0.8

then 'Underweight'

elseif sum([Efficiency Score])>1.2 then 'Overweight'

ELSE 'Healthy'

END

• 6. Re: Slicing a column into three categories to display as a Histogram

Hi Praveen,

The Efficiency Score is an aggregate function so I cannot put another aggregate on top of it

Let me clarify. The Efficiency score is a product of two ratios i.e x/y * a/b. Those ratios are also calculated using Tableau.

It's curious because I can use the formula in color to differentiate between the three groups but I cannot create a histogram

• 7. Re: Slicing a column into three categories to display as a Histogram

Yes you can formula in the above view because you are dis-aggregating the data with site id in the above view

Please provide some sample data if possible

Thanks,

Sreekanth

• 8. Re: Slicing a column into three categories to display as a Histogram

Please find the data in the picture below:

Efficiency Score = Ratio Volume * Ratio Collections

Ratio Collections = Sum(#ofcollections)/Median Optimal Collections

Ratio Volume = Volume Collected(YDS)/Potential Volume Collected

Potential Volume Collected = Median Optimal Collections * Median Site Volume YDS