admin管理员组

文章数量:1129440

I have an RDLC report with a Pie Chart that has a category grouping and I'm trying to obtain the index of the current slice because I want to use it in the expression that computes the slice's color.

However, I can't seem to make it work. I've tried the following expressions:

=RowNumber(Nothing)

or

=RowNumber("Category_Group_Name")

or

=RowNumber("Chart_Name")

or

=RowNumber("Dataset_Name")

but none of these return the correct values, there are always duplicate values and/or skipped values.

What I'm looking for is the index of the slice (which is the same as the index of the legend entry), how do I correctly do that?

For clarity, the following screen shows how the chart is configured:

I have an RDLC report with a Pie Chart that has a category grouping and I'm trying to obtain the index of the current slice because I want to use it in the expression that computes the slice's color.

However, I can't seem to make it work. I've tried the following expressions:

=RowNumber(Nothing)

or

=RowNumber("Category_Group_Name")

or

=RowNumber("Chart_Name")

or

=RowNumber("Dataset_Name")

but none of these return the correct values, there are always duplicate values and/or skipped values.

What I'm looking for is the index of the slice (which is the same as the index of the legend entry), how do I correctly do that?

For clarity, the following screen shows how the chart is configured:

Share Improve this question edited Jan 8 at 17:53 Master_T asked Jan 8 at 17:47 Master_TMaster_T 7,90315 gold badges88 silver badges167 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

After some more trial and error, I've found the correct way. The correct expression to use is:

=RunningValue(CountDistinct(Fields!YourGroupingField.Value, "CategoryGroupName"), Sum, "ChartName")

Basically, this keeps a running count of the distinct count of the grouping property within the grouping (which is always 1), so it will effectively keep track of the group index, which is the index of the slice of the pie.

本文标签: reporting servicesGetting the slice index in a pie chartStack Overflow