How to add group name in grand total?

  • Customer ProductSalesTotalUnits

    2123$1030

    2245$1230

    2964$1430

    2$3630 -- Avg of Total units per customer

    8456$3050

    8789$4050

    8$7050

    GrandTotal$10638

    I need to average the total units field in grand total. When I just use average it gives me 38 (30+30+30+50+50/5).

    But I need to calculate it as 40 (30+50/2).

    I have grouping on Customer, so if I use

    Avg(Fields!UnitsShipped.Value,”GrouponCustomer”) in grand total it is giving me error.

  • What is the error you are getting?

  • It is not giving me any error. It is just not displaying the average like I want. In the grand total it shows the average for Total Units column as 38 (30+30+30+50+50/5).

    But I need to calculate it as 40 (30+50/2).

    I just used Avg(TotalUnits).

  • The AVG function works exactly as you described which is a bit annoying to say the least. Typically, if you want the real average you have to write the expression yourself. Try something like:

    SUM(Fields!UnitsShipped.Value)/COUNT(Fields!UnitsShipped.Value)

    in the grand total and you should get what you are looking for.

    Good luck, Steve

  • Hi Steve,

    This still gives me the same value i.e. 38. It does the same way like average function do i.e. (30+30+30+50+50/5).

    I need it to calculate 40 (30+50/2).

  • Sorry, I read this too quickly the first time. I think this is what you are trying to accomplish:

    http://beyondrelational.com/blogs/jason/archive/2010/07/03/aggregate-of-an-aggregate-function-in-ssrs.aspx

  • Thank you, I think this will help me.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply