I have some data coming from a custom dataset that look like the following example
Person Age
P1 20
P2 21
P3 30
P4 31
P5 40
And I want to develop a pie showing the age distribution against the age.
The point is that I want this Age to be shown in ranges. (20-29, 30-39, etc for example So we have: Slice with total number =2 (P1 + P2) as age is 20-29 (one at 20 and another at 21)
Slice with total number =3 (P3 + P4) as age is 30-39 (one at 30 and another at 31)
Slice with total number =1 (P5) as age is 40 (one at 40).
How can i customize the pie chart开发者_JS百科 to aggregate values by ranges that I can define?
Right click Chart -> Data -> Category Groups, Change the Data values Group on expression and the Labels to something like
=Switch(
Fields!Age.Value < 25, "Under 25",
((Fields!Age.Value >=25) AND (Fields!Age.Value < 35)), "26 - 35",
((Fields!Age.Value >=35) AND (Fields!Age.Value < 45)), "36 - 45",
((Fields!Age.Value >=45) AND (Fields!Age.Value < 55)), "46 - 55",
((Fields!Age.Value >=55) AND (Fields!Age.Value < 65)), "56 - 65",
Fields!Age.Value > 65, "Over 65"
)
精彩评论