5 Replies Latest reply on Nov 15, 2013 7:21 AM by Dallin Crump

Complex query! (for a newbie)

I am working with a set(attached). This is an exhaustive list - I need to pick the top 5 in terms of totals and calculate a percentage.

For example Allergy total=540

Table total =1404

then Allergy% should be 38%

Based on the above calculation I need to pick top 5 (I cant do this manually everytime - the top 5 automatically need to be picked)

Once this is done, I need to replicate the attached chart (horizontal stacked bar chart)

Remember now when we pick the top 5 , the 38% should REMAIN 38% and should not be higher percentage based on the sub-set (i.e top 5 items).

• 1. Re: Complex query! (for a newbie)

Santhosh,

Making use of a table calculation ("Rank") to assign a rank for each value, and another table calculation to get the % of total, I think I was able to achieve what you are looking for.

Best,

Dallin

• 2. Re: Complex query! (for a newbie)

I am unable to open this file. It says it was created by a newer version of Tableau - any idea how I can get this to work?

I have version 7

Thanks again,

Santhosh

• 3. Re: Re: Complex query! (for a newbie)

I have created a Tableau 7 version for you.

Dallin

• 4. Re: Re: Complex query! (for a newbie)

Dallin, thank you for the solution; however I have one question:

Your tab "Table" seems good and is exactly what I need!

However in the tab called "Chart" I want to understand how you chose those 5 Row Labels (i.e  Allergy, Organic etc) - was this manual?  I need this to be automatic - i.e the top 5 by  Grand Total. Hope this makes sense?

Thanks again,

Santhosh

• 5. Re: Re: Complex query! (for a newbie)

I got the top 5 row labels in the chart by filtering on the Rank table calculation.

Dallin