SQL Server Report Builder: how to obtain SUM(Value) of each group

nisuyaves picture nisuyaves · Feb 17, 2012 · Viewed 7.6k times · Source

I have a report group by Field1 separated by pages, in each page I group by Field2.

So, my page is:

      Field1     Field2      SUM(Volume)

      ...

                 Total       SUM(Volume) --This is the value that I want to use!!

I have a Volume field that I want to do a percentage:

Sum(Fields!Volume.Value) is the aggregation of the value, that is correct
sum(Fields!Volume.Value, "DataSet2") is total of everything, that is incorrect because I want total of each page.

I am doing:

=(Sum(Fields!Volume.Value) * 100) / sum(Fields!Volume.Value, "DataSet1")

I am using, Report Builder 2.0 and I am not able to change.

I hope I explained myself ok,

Thanks!

Answer

Lamak picture Lamak · Feb 17, 2012

You can do aggregations with the total of a group (in this case, the Field2 group), using it as if it were a dataset. So, try this:

(Sum(Fields!Volume.Value) * 100) / sum(Fields!Volume.Value, "Field2")

But replace Field2 with the actual name of that group.