Groups | Blog | Home
all groups > sql server reporting services > october 2005 >

sql server reporting services : MDX - Pie Chart - Reporting Services



Stuart
10/16/2005 11:09:09 PM
Hi

I am want to create a pie chart in a reporting services report, but am
unsure how to best write the MDX to get the results I need. Say I have
some MDX like this:

Select
[Measures].[Dollars] on columns,
[Organisation].[Organisation].Members on rows
from
[Sales]

This would return the Sales for each organisation, which is ok, but now
I need to make a pie chart which shows segments for the sales for the
top 5 organisations, and all of the rest of the organisations are
lumped into a segment called Other (so the pie chart will have 6
segments). I can easily use topcount to modify the above query to get
only the top 5 organisations, but I am unsure how to get the top 5 and
lump all of the rest of the organisations into another seperate row.
Can anyone tell me how to write the MDX that I require ? or is there a
way to configure the pie chart in reporting services to do what I want?

thanks

Stuart
Stuart
10/17/2005 3:24:34 PM
I have worked out a solution for this if anyone is interested. I have
created a calculated member which displays the organisation name if it
is in the top 5, or shows the string "Other" if it is not. Now just do
the chart using the calculated member as the group.

with member [Measures].[GroupName] as
'iif([Measures].[Dollars],iif(CROSSJOIN(topcount([Organisation].[Organisation
Name].[Organisation
Name].Members,5,[Measures].[Dollars]),[Organisation].[Organisation
Hierarchy].currentmember).Item(0).Item(0).Name =
NULL,[Organisation].[Organisation
Hierarchy].currentmember.Name,"Other"),NULL)'
AddThis Social Bookmark Button