SSRS: Can you have the label of a (pie) chart be both the category AND the Percent

ajspacemanspiff picture ajspacemanspiff · Oct 24, 2013 · Viewed 14.9k times · Source

I have a pie chart in SSRS. It contains many categories so it is kinda hard to read. What I would like to do is include the category AND the percent in the label, but I am not sure how to do this.

You can include the category by setting the label to [CategoryName] (this is the default). You can include the percent by changing that to #PERCENT. But I cannot seam to figure out how to include both.

Is there a VBA formula that I can add that will give me both?

Answer

Ian Preston picture Ian Preston · Oct 24, 2013

You can actually just shove #PERCENT into a larger string.

Some simple data:

enter image description here

And a simple chart based on this:

enter image description here

The expression used for the labels is:

=Fields!grp.Value & ": " & "#PERCENT{P2}"

Here {P2} is controlling the formatting. You should be able to adapt to your scenario.

Alternatively, for greater control you can just add the relevant % calculation in the label expression; in the above case this would be:

=Fields!grp.Value
    & ": "
    & Format(Sum(Fields!val.Value) / Sum(Fields!val.Value, "MyDataSet"), "P2")

Which in this case gives identical results to the above.