### Title

Calculation for selling price and margin

Calculation for selling price and margin

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

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.

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.

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.