Introduction
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.
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
];
Creating the Chart
Now you’ve data to be used to create a chart, use the following steps do create a Population Pyramid.
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
.
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
.
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.