SQL Server 2005 | SQL Server 2008
Pie chart with too many categories don’t make much sense. The following screenshot shows the order count from the AdventureWorks OLAP database by subcategory (no selection on date here for this example) as a pie chart:
Fortunately, SQL Server 2008 Reporting Services adds a feature to collect all slices below a certain threshold (either as a fixed value or as a percentage) as shown below:
To get this result you have to check the custom attributes (properties) of the chart series (either by selecting the pie itself or by choosing the chart series in the property box picker)
In our example I collected all slices with a value of less than 3% to one single slice with the name ‘Other’. You can even show the other values as an exploded pie chart (although I think it’s more confusing).
In cases where you want to show just a certain number of slices (instead of using a threshold) or if you are using Reporting Services 2005 which doesn’t support the collected slice, you may do the collection by MDX:
SET SelectedSubCategories AS
SET OtherSubCategories AS
[Product].[Subcategory].[Subcategory] - SelectedSubCategories
MEMBER [Product].[Subcategory].[Other] AS
[Measures].[Order Count] ON 0
} ON 1
FROM [Adventure Works]
CELL PROPERTIES VALUE;
The idea is quite simple. First, you create a set with the number of slices you want to see (I called it SelectedSubCategories here). Then you can simply get all other categories using a set minus operation (I called it OtherSubCategories here). Finally you create the ‘Other’ member in the dimension as an aggregate of the last set.
Of course, you can even make the parameter for the number of slices a report parameter so the user can choose how many slices are shown in the diagram.