Population Pyramid

De Qknow
Ir para: navegação, pesquisa

Introduction

PiramideEtaria3.PNG

This document shows you how to configure a bar chart to create a Population Pyramid visualization. By default, QlikView doesn't have a Pyramid chart, but is possible to create one using a bar chart as a platform. On picture at side, population is split between gender and distributed along of years intervals. So, is possible see how many people are male or female, by period. Of course this technique is useful for different purposes. Sales, billing, products, etc. All you need to create this chart is a dimension and two expressions. Each expression will represented by a color. Therefore, for male and female is necessary two expressions, one for each gender. Sometimes, this data can be filled in one column, so, you should create two expressions using Set Analysis.

To test this chart you could load data sample below. This doc will show you step by step how to configure the chart. If you prefer, a file is available for download, here.


Don't you have QlikView?

DownloadFree1.PNG



If you are new in QlikView, follow the steps bellow:

1. Open QlikView Desktop 11 and create a new project (document).

2. Cancel the data load wizard if is showed for you.

3. From File menu click Edit Script, or press CTRL + E.

4. Some instructions are show. It's not necessary change anything. Just put the cursor bellow all row (blank line).

5. Copy the following instructions and past where cursor is.

DataTable:
LOAD * INLINE [
    Interval, Male, Female
    More then 100 years old, 7.247, 16.989
    95 a 99 years old, 31.529, 66.806
    90 a 94 years old, 114.964, 211.595
    85 a 89 years old, 310.759, 508.724
    80 a 84 years old, 668.623, 998.349
    75 a 79 years old, 1.090.518, 1.472.930
    70 a 74 years old, 1.667.373, 2.074.264
    65 a 69 years old, 2.224.065, 2.616.745
    60 a 64 years old, 3.041.034, 3.468.085
    55 a 59 years old, 3.902.344, 4.373.875
    50 a 54 years old, 4.834.995, 5.305.407
    45 a 49 years old, 5.692.013, 6.141.338
    40 a 44 years old, 6.320.570, 6.688.797
    35 a 39 years old, 6.766.665, 7.121.916
    30 a 34 years old, 7.717.657, 8.026.855
    25 a 29 years old, 8.460.995, 8.643.418
    20 a 24 years old, 8.630.227, 8.614.963
    15 a 19 years old, 8.558.868, 8.432.002
    10 a 14 years old, 8.725.413, 8.441.348
    5 a 9 years old, 7.624.144, 7.345.231
    0 a 4 years old, 7.016.987, 6.779.172
];

6. The previous instructions are in fact a kind of table that contains 3 columns. Now, save the project.

7. From File menu click Reload or press CTRL + R to load this table to memory.


Creating the Chart

Now you've data to be used to create a chart, use the following steps do create a Population Pyramid.

ChartType1.png

1. Create the chart clicking with right mouse button at any empty place on document and select New Sheet Objects.

2. When the shorcut menu is show, click Chart. Many types are available, but select the first one.

3. First one is a bar chart. After selected it, click Next button.

4. The Dimensions window is showed. From available fields, click Interval and add it to Used Dimensions.

ExpressionBarChart2.PNG

5. Click Next button to show expression window. Enter the following formula: =SUM(Male). After that, click Ok.

6. Click Add button to enter a new expression. Enter the following formula: =SUM(Female) * -1

7. For each expression, change the Label properties to Male and Female, respectively.

8. For both expressions, click Values on Data Points.

ChartOrientationSubtype1.png

9. Go to next step clicking Next button. In Sort tab, change text order for Internval field to Z > A.

10. Advance to next step clicking Next again. Now, change the chart orientation to horizontal. See image at side.

11. At same place, change the chart sub-type to stacked. See image at side.

12. Advance to Axes tab, clicking Next twice. Click Hide Axes.

13. Goto Number tab to change number formating. Use the following pattern for both expressions: #.##0;#.##0

This pattern has two parts. Before semicolon is used to formating positive numbers, while after semicolom is desined to format negative numbers.

14. Close wizard clicking Finish button.


Maybe you wanna change some properties to get a best design. Some aspects you can change are colors, position of legend, font size, etc.



Learn More About...

Arrow Comparing Last Year 1.png

Add Arrows to Compare Previous Data

This article describes how to use arrows to compare data with previous period. This

technique is useful when a lot of information needs to be present in a short area.

So, chart at side is displaying four information including total for each dimension

value, percentage of total, arrows indicating percentage variation and colors showing

a specific group of each bar.

Do you want know how? Click here!.



Idea 1.jpg

Learn to use variables to replace hard expressions.

Variables can get parameters to change its formulas. Learn more here!


Envelope01.jpg
Need more? Mail Us!



Back | Summary | Main Page