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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with formula using count as divisor

Status
Not open for further replies.

AcctSolver

Technical User
Sep 27, 2003
28
US
I am trying to develop an extended price for an order report. The hitch is that a single order line may refer to a single quantity of one product that needs to be split out into four or more different ledger accounts.
Here is an example of some data, as I want it to display.

OrderNo OrderLineNo Sequence LedgerAcct Qty UnitPrice Amount Product
123 1 1 53101 1 1,025.00 256.25 998
123 1 2 53601 1 1,025.00 256.25 998
123 1 3 54932 1 1,025.00 256.25 998
123 1 4 58314 1 1,025.00 256.25 998
124 1 1 53101 2 150.00 300.00 999
125 1 1 53601 1 350.00 350.00 555
125 2 1 54932 4 50.00 200.00 852

This is how it does look
OrderNo OrderLineNo Sequence LedgerAcct Qty UnitPrice Amount Product
123 1 1 53101 1 1,025.00 1,025.00 998
123 1 2 53601 1 1,025.00 1,025.00 998
123 1 3 54932 1 1,025.00 1,025.00 998
123 1 4 58314 1 1,025.00 1,025.00 998
124 1 1 53101 2 150.00 300.00 999
125 1 1 53601 1 350.00 350.00 555
125 2 1 54932 4 50.00 200.00 852

What formula for Amount would I need to create in order to have it work so for every combination of OrderNo and OrderLineNo, if there is only a Sequence 1, then Amount = QTY*UnitPrice. If there is more than a sequence one, the count the number of sequences, then take (1/sequence count)*Qty*Unit Price.
 
I am assuming that the Sequence Number in Order 123 increase over the first 4 lines because it is the same product. If this assumption is correct:

1. Create a new formula that concatenates the Order Number and Product. If they are Numbers (as opposed to numeric text) you will need to convert them to text (using ToText) in the formula.

2. Insert a Group on that formula (the GH and GF can be suppressed so they are not displayed);

3. Create the following formula to replace the "Amount" field in the report:

Code:
1 / Maximum({Table.SEQ}, {@YourGroupFormula}) * {Table.QTY} * {Table.UNIT PRICE}

Hope this helps.

Cheers
Pete.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top