7 Replies Latest reply on May 15, 2013 1:04 AM by Adrian Mitroescu

# Age population graph

Hi Guys,

Just a quick question from my side:

I have a field which shows the distribution of population using a certain service per age group. I would like to have the following: a graph where to see in columns the actual distribution (<18/ 18-30/ 30- 60/ >60) and in the rows to have data from the same field, but as a percentage. So it should look like this:

100%

|

|                                         40%                    30%

|                20%

|                                                                                               10%

|   __________________________________________________________

0%           <18 yrs           18-30 yrs              30- 60 yrs              >60 yrs

I have been trying to figure it out, but I can't seem to do it, maybe you have some suggestions?

Thank you!

• ###### 1. Re: Age population graph

It is certainly possible!  I've attached a workbook to show how it can be done.

The two main components are:

1. A calculated field for the Age bin

2. Using a quick table calculation for the percent of the number of records.

Here are the details:

1. The calculation is:

IF [Person_Age] < 18 THEN "< 18 yrs"

ELSEIF [Person_Age] < 30 THEN "18 - 30 yrs"

ELSEIF [Person_Age] < 60 THEN "30 - 60 yrs"

ELSE "> 60 yrs"

END

2. To get the percent, right click the Number of Records field on Rows and select "Quick Table Calculation" --> "Percent of Total".

Hope that helps!  I'd be happy to answer any questions.

Regards,

Joshua

• ###### 2. Re: Age population graph

Hi Joshua,

That's great. Now I just realized that I miss something else: how can I split each percentage per women and men? For example: where I have 66% <18yrs, I would like to have half of that colored in red (women) and the other half in blue (men), of course if we consider 50% - 50%. So to also look at the percentage of women and men which compose a certain category (in this case <18 yrs). I also have a column in my data file which shows on each row if we are talking about a man or a woman.

Thanks!

• ###### 3. Re: Age population graph

Sure.  If you add gender to the color shelf it should split nicely.  I also added a reference line to keep the total % for each stacked bar.

Regards,

Joshua

1 of 1 people found this helpful
• ###### 4. Re: Age population graph

Hi Joshua,

Are you using Tableau 8? I tried to open your files and it says that they were created in a different version than mine.

• ###### 5. Re: Age population graph

Yes.  The files are for Tableau 8.  I'll try to recreate them in 7 and re-post shortly.

Regards,

Joshua