ASalameh
ASalameh

Reputation: 803

How to calculate rdlc tablix rows sum and rows count in textboxes

I have tablix named tablix2 and have 3 columns ,I want to calculate rows sum and count in 2 textboxes out of the tablix scope, I try this expression.

=RowNumber("Tablix2")

And

=CountRows("Tablix2")

And

=Count(Fields!ID.Value,"Tablix2")

Its always show me this error message:

The Value expression for the text box ‘Textbox7’ has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a dataset.

Upvotes: 5

Views: 40040

Answers (3)

Marc Guvenc
Marc Guvenc

Reputation: 81

I created a report footer and added this code to a textbox below. DataSet1 is the name of the dataset in the report (case-sensitive). Fields doesn't change. Sym is the name of the column in the details of the report,

=Count(Fields!Sym.Value,"DataSet1").

Upvotes: 0

Del Lee
Del Lee

Reputation: 482

Right Click on the tablix on the last row in the group (you have to do this in the "handle" area to the far left because you get a different right click menu if you click in the row area), then choose "Insert Row" and "Outside Group Below." Merge cells as necessary and drag a textbox into the one you want to put the value. Then put =Count(Fields!ID.Value) for the expression inside the textbox to get the group count, for example.

This worked for me, but I agree it is far from intuitive and doesn't appear to be documented well anywhere for what should be such a basic feature in a reportwriter.

Upvotes: 1

Sam
Sam

Reputation: 7313

You need to use a scope name which is valid. If you're outside of the tablix then you should use dataset scope probably.

Try something like

=Count(Fields!ID.Value,"DatasetName") or

=Sum(Fields!ID.Value,"DatasetName")

Upvotes: 7

Related Questions