Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running Total with formula isn't always working as expected

Status
Not open for further replies.

NBVC

Technical User
Sep 18, 2006
80
CA
I have a report with a Running total that is to Evaluate based on a formula:

Code:
NOT({PURC_ORDER_LINE.PURC_ORDER_ID}= next({PURC_ORDER_LINE.PURC_ORDER_ID}) and {PURC_ORDER_LINE.LINE_NO}= next({PURC_ORDER_LINE.LINE_NO}))

The field to Summarize is based on a formula field called @fla_extended_amt, which is basically this formula: {RECEIVER_LINE.RECEIVED_QTY} * {@fla_unit_price}

and the @fla_unit_price formula is:

Code:
if isnull({PART_UNITS_CONV.CONVERSION_FACTOR}) or {PART_UNITS_CONV.FROM_UM}={PURC_ORDER_LINE.PURCHASE_UM}then
  {PURC_ORDER_LINE.UNIT_PRICE}
else
   {PURC_ORDER_LINE.UNIT_PRICE}*{PURC_ORDER_LINE.USER_ORDER_QTY}/{RECEIVER_LINE.RECEIVED_QTY}

and I get results for each record, so they should be summing up.

It works for the most part, but I can't figure out why in 1 case it is not summing properly.

the formula above is to make sure that duplicate records are not shown and used in summation, which it is doing.

I have 3 records with 3 amounts, yet only 2 of the 3 are getting summed.

Note: If I change the Running Total to Evaluate at each change in Record, then I get the proper sum.

Not sure if that is enough info for you. Let me know what else I can provide, if anything.
 
I think I have fixed this by changing the Running Total formula to:

Code:
NOT({PURC_ORDER_LINE.PURC_ORDER_ID}= previous({PURC_ORDER_LINE.PURC_ORDER_ID}) and {PURC_ORDER_LINE.LINE_NO}= previous({PURC_ORDER_LINE.LINE_NO}))

i.e. I changed next to previous
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top