How To: Create Age Pyramid Charts in Reporting Services 2008

Michael Könings Blog

a generalist's specialties

How To: Create Age Pyramid Charts in Reporting Services 2008

Rate This
  • Comments 1

I had to create charts for a HR department that show the  distribution of age (or years of service) and gender in organization units. The customer wanted that typical Christmas tree look, which shows a symmetric bar chart in two directions, like shown in the example below.



There are two challenges here:

  1. make the tree look symmetric, the left and right bars should be in line.
  2. make the labels and axis show positive values, even on the left side of the graph.

How can you achieve that in Reporting Services ?

We use the Dundas chart control with the Bar Chart layout. A stacked bar chart did not work too well for me, it did not put the labels on the tip of the bars.

To have the values point in to directions multiply one set of data with -1. you can do that in your query or by editing the value expression.


The value expression for the data column might look like this:

=IIF(Fields!Gender.Value = "Male" , Sum(Fields!Head_Count.Value),Sum(Fields!Head_Count.Value)*-1)

Since we have gender on one axis, it will show the values in two different colours.


The default settings of the bar chart will draw the different bars with a little offset (side by side), so it would not look symmetrically. I found this parameter that sorts this one out:


the Custom Attribute DrawSidebySide of the Chart Series should be set to False. Now the two bars for each gender in one time period are in line nicely.


What's left to do?

We need to take care of the negative label values for the gender pointing to the left. You guessed how I did it:

change the series label Format property and the Axis LabelsFormat to your wish:

0;0  did the job for me.


That's it!  Maybe you have a better way to do it ? Let us know! Put a comment!

Too brief ? ask questions!


Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Post
  • Thanks! it works brilliantly

Page 1 of 1 (1 items)