5 Replies Latest reply on Jan 26, 2014 9:16 AM by philmodjunk

# Calculation for selling price and margin

### Title

Calculation for selling price and margin

### Post

Hi i am very new to FM Pro 11.  I know how to calculate Margin when cost and selling price is available or to calculate selling price when cost and margin are available but i want to build my fields in such a way that it gives me option to enter either fields ( selling price or margin) and the other should be automatically calculated for instance:

Cost Price = 100 (Available)
Sell Price  =  Calculation field or ??
Margin     =  Calculation field or ??

If i put 160 on sell price it should automatically put 37.5% in margin or if i put 37.5% in margin field it should automatically fill sell price for 160.

I have seen this in other database (not filemaker pro).

Any help will be highly appreciated.

Thank you

• ###### 1. Re: Calculation for selling price and margin

Try setting up number fields with auto-enter calculations. They should allow you to either enter a value or allow the DB to calculate a value.

• ###### 2. Re: Calculation for selling price and margin

Thanks for your reply.  I did what you said but didn't work.  I created three fields cost_price, sell_price and margin_percentage.  cost_price  field as number, selling_price field as number and auto calculation with formula sell_price =  cost / ( 1 - margin percentage ) and margin percentage number field and auto enter calculation margin percentage = 1 - (cost_price / sell_price).  I put cost_price = 100 and it showed 100 in the sell_price, so i change sell price to 160 to see if it compute margin but showed 0 in the margin field.  so i unchecked option "Do not replace existing value of field if any" under calculation check box but it did not work.

• ###### 3. Re: Calculation for selling price and margin

I think that you meant that you set up these fields: (See change in red)

Cost_Price
sell_price =  cost_price / ( 1 - margin percentage )
margin percentage = 1 - (cost_price / sell_price)

What I would try is:

sell_price =  If ( IsEmpty ( self ) ; cost_price / ( 1 - margin percentage ) ; self )
margin percentage = If ( IsEmpty ( self ) ; 1 - (cost_price / sell_price) ; self )

And I think that will require clearing the 'do not replace...' check box in order to correctly update.

• ###### 4. Re: Calculation for selling price and margin

i copy and paste your calculation and unchecked 'do not replace... but it did not work.  do i have to replace "self" with the field name.

• ###### 5. Re: Calculation for selling price and margin

You will not need to replace "self". How does it "not work"?

Only copy the text to the right of the "=" sign when you copy and paste these expressions.