6 Replies Latest reply on Nov 28, 2012 6:05 AM by Julia Hennelly

# Percent calculations

Yet again I struggle with what should be simple percent calculations.  I am looking at test results of employees who are either experienced or inexperienced and taking baseline or reassessment.  I need to show a label that shows at a particular hospital of the employees who took the test in a particular quarter the percentage that were acceptable.  I feel this should be simple but I am not seeing it and have tried various approaches.

Packaged workbook attached.

Any help much appreciated.

• ###### 1. Re: Percent calculations

If you choose Compute using -> Experienced instead of advanced partitioning, then I think it should work the way you want.

When you specify Experienced, the layout of the sheet makes your table calculation figure out the rest automatically.

1 of 1 people found this helpful
• ###### 2. Re: Percent calculations

Thank you - that was helpful but I realized I need to add another dimension and then I got what I expected.  Next issue is colour coding the whole thing.  I need to background colour the value depending on whether it is below a threshold value chosen by the user.  Right now I am trying to code so that it is red if less than 50% and green if more.  I then know how to add a parameter to make that more dynamic.  I am not getting my desired results so clearly am doing something wrong!

Ideas?

Julia

• ###### 3. Re: Percent calculations

Use the following formula for your Threshold calculated field:

IF COUNTD([Employee]) / TOTAL(COUNTD([Employee])) < 0.5 THEN 'less than 50%'

ELSEIF COUNTD([Employee]) / TOTAL(COUNTD([Employee])) >= 0.5 THEN 'more than 50%'

ELSE Null

END

and set to compute using Acceptable.

You might need to take Threshold off the Color shelf and put it back on to make it work, and you'll have to edit the colours again.

1 of 1 people found this helpful
• ###### 4. Re: Percent calculations

This is very helpful - thanks!  I am not quite there.  I think the calculation is the one I need but now am not sure I am applying it correctly.  I basically need to background colour each cell based on this calculation which ultimately will be parameterized.  I thought a square shape with this calculation would provide what I need but it is not.  I am trying to recreate the second picture here.  Is there another easier approach?  I basically want to conditionally format the back ground colour of a cell.

Julia

What I have!

What I need

• ###### 5. Re: Percent calculations

I assume you want to see cells of the table nicely filled with colour, as opposed to square blobs inserted into every (rectangular) cell. Looks like current version of Tableau is not very good at it. You might improve you current view with some formatting, resizing and fiddling, but I don't know of a simple trick that would do it.

The good (but possibly not very helpful in your situation) news is that upcoming version 8 does a much better job:

1 of 1 people found this helpful
• ###### 6. Re: Percent calculations

Thank you.  I guess I shall colour the text until version 8 when I can conditionally colour the background.  Seems incredible that this is not available in version 7.

Julia