create pie chart with custom category from dataset
Hello All
I have a question about creating a pie chart which needs custom categorizinf from the data set in SSRS2008
below is the table that will be used as source of pie chart.
Task Title
Task duration (# of weeks spent)
Task 1
2
Task 2
5
Task 3
3
Task 4
7
Task 5
9
from the data set i need to set categories as below
Category1: duration (Number of weeks) 1 - 4
Category2: duration (Number of weeks) 5 - 8
Categpry 3: duration (Number of weeks) 9 - 12
Then the # of task for each category will be the value for the pie chart.
I need the help to set the custom category based on the # of weeks in duration column.
and need to set custom legend diaplaying 'Shorter than 1 month' for category1 , 'Shorter than 2 months' for category2 and 'Shorter than 3 months' for category 3
Can anyone show me or give tips how i can accomplish this?
Thank you in Advance
January 18th, 2011 10:35pm
I found one solution for this and decide to share.
I modified SQL query generating data set and added case statement to generate duration range and use 'DurationRange' as alias.
After SQL query was modified i used DurationRange data field as category and used expression with count function to get value.
though i solve this by modifying SQL query i still wonder if there are any posibilities to solve this using expression only without modifying SQL query
sig
Free Windows Admin Tool Kit Click here and download it now
January 19th, 2011 11:18pm
Hi AJ,
As you tried, one approach is to modify the query to add a duration range field, and thank you for sharing your solution.
It is also possible to achieve this by using expression in the report. Please refer to the steps below:
1.
Add a Pie Chart the Report.
2.
Add the data field
TaskTitle to the data field area of the chart.
Add the data field
TaskDuration to the category field area of the chart.
3.
Right the data field
TaskDuration in the category area of the chart, and select
Category Group Properties…
4.
For the
Label property, specify the expression like
=Switch(Fields!TaskDuration.Value<=4,"Shorter than 1 month",
Fields!TaskDuration.Value>4
AND Fields!TaskDuration.Value<=8,"Shorter than 2 months",
Fields!TaskDuration.Value>8
AND Fields!TaskDuration.Value<=12,"Shorter than 3 months")
5.
For the
Group on item in the Group Expression section,
also change it to the same expression above.
6.
Click
OK.
After that, the Pie Chart will be categorized as needed.
Thanks,
Tony ChainTony Chain [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
January 23rd, 2011 8:28am