Question

I am trying to perform an aggregation on a calculated Field in SSRS and am getting the following error:

[rsAggregateReportItemInBody] The Value expression for the textrun 'Textbox43.Paragraphs[0].TextRuns[0]' uses an aggregate function on a report item. Aggregate functions can be used only on report items contained in page headers and footers

This is the formula I tried to use:

=Sum(ReportItems!PlanPurchPrice.Value, "Select_UCPUtilization")

In this Case PlanPurcPrice is also an Expression:

=First(Fields!PawPlanPurchPrice.Value, "Select_UCPUtilization")

Any suggestions on this would be greatly appreciated.

Was it helpful?

Solution

SSRS 2008 does not support the functionality you are looking for unless the report item is located in the header or footer (as is stated in the error message). I would, instead, propose two alternate solutions:

First Option

Place the calculation in your query (if possible) at which point you can then reference the field and the aggregate will work as desired.

Second Option

You essentially want to create the aggregate you're looking to return elsewhere in the report where it is directly connected to the Select_UCPUtilization scope, then reference the aggregated value elsewhere. Follow these steps:

  1. Within the same scope as report item PlanPurchPrice, calculate a sum of the PlanPurchPrice. Name the textbox containing the aggregate something meaningful (e.g., Sum_PlanPurchPrice).
  2. Reference that textbox directly wherever you were trying to use the ReportItems sum before (i.e., =ReportItems!Sum_PlanPurchPrice.Value)

  3. Hide the workaround. Place the aggregate you created in an additional column or row attached to the Select_UCPUtilization scope. Turn the text white, turn off growth and shrinkage, and make the row very tiny (a pixel or two high).

Using the second option, the report item does exist (and is visible, which is important) on the report and contains the sum you are looking to return elsewhere.

Hope this helps. if this doesn't make sense, please reply via comment and I'll help you to the best of my ability.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top