We help IT Professionals succeed at work.
Get Started

calculating weighted averages on an SRS report

1,446 Views
Last Modified: 2012-05-10
Hello,

I have been around in circles with this and cannot figure this out. I am trying to get the weighted average on a sql report based on a count and an amount.

So first I get the average price of something we sell by creating an expression: Price/Count
(it will not let me do a calc field because I am using the count aggregate function)
We only sell 4 major items, which I am basing my report on. So I know that the next step is to take each of my item's average price, multiply it by the count for that item, add up those totals, then divide by the total count.

I have tried variations on this expression:
=(SUM((Fields!CRDTAMNT.Value/COUNT(Fields!ACCOUNT.Value))* COUNT(Fields!ACCOUNT.Value)))/COUNT(Fields!ACCOUNT.Value)

(Account is the count) and I keep getting errors about nested aggregate functions.

Does anyone know how to do this?

Thanks!
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 13 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE