Skip to Content
1
Former Member
Aug 02, 2012 at 07:06 PM

Logic to accumulate months

180 Views

Hi all,

I have a requirement to implement a logic that generate the average cost of production.

This average cost is the sum of the entries of the production divide by the sum of entries in quantity(ton).

The key gere is that I need for a month the sum of prior months.

For example, assuming the calculation of APRIL, is something like:

AVARAGE = (COST (JAN,FEB,MAR,APR) / (TON (JAN,FEB,MAR,APR)

I already tried a logic using the *FOR statement for the range of months, and inside the loop I used the *ADD statement.

But with no sucess.

Thanks in advance for the help.

Lucas