×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Average Calculation

## Average Calculation

(OP)
Hi,

How can I calculate the moving average value of a particular item which purchased multiple times.

Please let me have some idea how to calculate the figure in Red.
The Arrow mark shows the field name.

Thanks

Abbassaif

I want to attach excel file. How can I do so?

### RE: Average Calculation

The calculation of a moving average is exactly the same as the calculation of any other average. You take the most recent N values of the figure in question, find the sum, and divide by N. In this case, N would be the number of periods over which you want to calculate the average.

But surely already know this. I suspect that, as usual, there is more to this problem that is indicated in the question.

And you mention in passing that you want to "attach" an Excel file (whatever that means). This is a completely separate issue, and should be posted in a separate thread, preferably with a title that indicates the nature of the question.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

### RE: Average Calculation

(OP)
Thanks Mr. Mike for the reply!

#### Quote:

And you mention in passing that you want to "attach" an Excel file (whatever that means). This is a completely separate issue, and should be posted in a separate thread, preferably with a title that indicates the nature of the question.

No, No I want to attach that excel file which is shown in image, just to check the formula for your reference and which I want to apply in my program.

Can I derived it from SQL Syntax.

Thanks

Abbassaif

(OP)

Thanks

Abbassaif

### RE: Average Calculation

In an attempt to keep this thread focused, can we concentrate on the original question. I wrote:

#### Quote (Mike)

The calculation of a moving average is exactly the same as the calculation of any other average. You take the most recent N values of the figure in question, find the sum, and divide by N. In this case, N would be the number of periods over which you want to calculate the average.

Is there anything in that that you don't understand?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

### RE: Average Calculation

Previously there were N number of items and the total cost was TOTAL_VALUE. So,
AVG_PRICE = TOTAL_VALUE / N

Then, M units have been issued out. So the value of the remaining units is
BALANCE_VALUE = TOTAL_VALUE - (M * AVG_PRICE)
BALANCE_STOCK = N - M

Next, again there is a new purchase N1 number of items for a total cost of NEW_ORDER_COST. Now the total value of the stock is
CURRENT_COST = BALANCE_VALUE + NEW_ORDER_COST.
CURRENT_STOCK = BALANCE_STOCK + N1

And the new average cost of per unit is
NEW_AVG = CURRENT_COST / CURRENT_STOCK

That's my understanding.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!