Margin Formula
This document is the implementation reference for the Business Calculator > Margin subpage in the Kesles Merchant app.
Active implementation reference:
business_margin_calculator_page.dart
Input
The calculator currently uses two main inputs:
CostSelling Price
Main Formulas
1. Profit per unit
profit_per_unit = harga_jual - modal
2. Margin
margin_persen = (profit_per_unit / harga_jual) x 100
Notes:
- if
harga_jual <= 0, margin is forced to0
3. Markup
markup_persen = (profit_per_unit / modal) x 100
Notes:
- if
modal <= 0, markup is forced to0
Meaning of the UI Metrics
On the page display:
Total Margin= gross margin against selling priceProfit / Unit= nominal profit per productMarkup= profit percentage against cost
Insight Criteria
The insight section uses the following rules, evaluated top-down.
Initial validation
- if
modal <= 0orharga_jual <= 0- title:
Complete Data - meaning: data is not yet sufficient to assess margin
- title:
Loss and break-even conditions
-
if
harga_jual < modal- title:
Negative Margin - meaning: every sale is still a loss
- title:
-
if
harga_jual == modal- title:
Break-Even Margin - meaning: selling price only covers cost, no profit yet
- title:
Positive margin levels
-
if
margin < 5%- title:
Very Thin Margin
- title:
-
if
margin >= 5% and < 12%- title:
Thin Margin
- title:
-
if
margin >= 12% and < 20%- title:
Margin Beginning to Form
- title:
-
if
margin >= 20% and <= 35%- title:
Healthy Margin
- title:
-
if
margin > 35% and <= 50%- title:
Strong Margin
- title:
-
if
margin > 50% and <= 70%- title:
Very High Margin
- title:
-
if
margin > 70%- title:
Margin Needs Validation
- title:
Insight Color and Visual Direction
Insights currently differ not only in text but also in icon and gradient color:
Complete Data-> light blueNegative Margin-> orange to redBreak-Even Margin-> yellow-orangeVery Thin Margin/Thin Margin-> yellow-orangeMargin Beginning to Form-> blueHealthy Margin-> greenStrong Margin-> green-blueVery High Margin-> purple-blueMargin Needs Validation-> stronger purple
The goal is for users to not only read the numbers but also receive a visual signal whether the margin is still weak, healthy, or needs to be re-validated.
Calculation Examples
Example 1
Input:
- cost:
Rp 40,000 - selling price:
Rp 50,000
Result:
profit_per_unit = 50.000 - 40.000 = 10.000
margin = (10.000 / 50.000) x 100 = 20%
markup = (10.000 / 40.000) x 100 = 25%
Insight:
Healthy Margin
Example 2
Input:
- cost:
Rp 100,000 - selling price:
Rp 90,000
Result:
profit_per_unit = 90.000 - 100.000 = -10.000
margin = (-10.000 / 90.000) x 100 = -11,11%
markup = (-10.000 / 100.000) x 100 = -10%
Insight:
Negative Margin
Example 3
Input:
- cost:
Rp 100,000 - selling price:
Rp 100,000
Result:
profit_per_unit = 0
margin = 0%
markup = 0%
Insight:
Break-Even Margin
Example 4
Input:
- cost:
Rp 100,000 - selling price:
Rp 105,000
Result:
profit_per_unit = 5.000
margin = (5.000 / 105.000) x 100 = 4,76%
markup = (5.000 / 100.000) x 100 = 5%
Insight:
Very Thin Margin
Example 5
Input:
- cost:
Rp 100,000 - selling price:
Rp 125,000
Result:
profit_per_unit = 25.000
margin = (25.000 / 125.000) x 100 = 20%
markup = (25.000 / 100.000) x 100 = 25%
Insight:
Healthy Margin
Example 6
Input:
- cost:
Rp 100,000 - selling price:
Rp 300,000
Result:
profit_per_unit = 200.000
margin = (200.000 / 300.000) x 100 = 66,67%
markup = (200.000 / 100.000) x 100 = 200%
Insight:
Very High Margin
Important Notes
This margin calculation is still a basic simulation. The value does not yet include:
- operational cost
- labor cost
- tax
- MDR
- discount or promo
- returns / damaged goods
- daily service fee
This means:
- the
Margindisplayed is a basic gross margin - not the final net margin
Recommended Next Enhancements
If the calculator is to become more realistic, the next version can add:
operational cost per unitMDR deductionaverage discountreturnsmonthly fixed cost
This way, users can see:
- gross margin
- operational margin
- net margin