## 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?

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

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)

Visual FoxPro articles, tips and downloads

## RE: Average Calculation

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

## RE: Average Calculation

Thanks

Abbassaif

Link

## RE: Average Calculation

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

Mike

__________________________________

Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

## RE: Average Calculation

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.