Search code examples
reporting-servicesssrs-2008reporting-services-2016

SSRS Reports giving me an aggregate error


Trying to do some math in SSRS and getting this error.

The Value expression for the text box ‘totalboxes3’ has an inner aggregate in an outer aggregate that specifies a dataset scope.  An aggregate that specifies a dataset scope cannot contain other aggregates.

I am using the expression:

=Sum(Fields!GP_Goal.Value, "Main") / Sum(Sum(Fields!Smartphone_Postpaid.Value) - Sum(Fields!CPE_Postpaid_Only.Value), "Main")

Im very new to SSRS so im trying to understand what this is asking me and how to fix it.

ive also tried

=Sum(Fields!GP_Goal.Value, "Main") / Sum(Sum(Fields!Smartphone_Postpaid.Value, "Main") - Sum(Fields!CPE_Postpaid_Only.Value, "Main"))

Solution

  • The problem is this:

    Sum(Sum(Fields!Smartphone_Postpaid.Value) - Sum(Fields!CPE_Postpaid_Only.Value)
    

    The outer SUM isn't needed, just subtract the sums and specify the dataset within the sums:

    =Sum(Fields!GP_Goal.Value, "Main") / (Sum(Fields!Smartphone_Postpaid.Value, "Main") - Sum(Fields!CPE_Postpaid_Only.Value, "Main"))