Lewati ke konten utama

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:

  • Cost
  • Selling 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 to 0

3. Markup

markup_persen = (profit_per_unit / modal) x 100

Notes:

  • if modal <= 0, markup is forced to 0

Meaning of the UI Metrics

On the page display:

  • Total Margin = gross margin against selling price
  • Profit / Unit = nominal profit per product
  • Markup = profit percentage against cost

Insight Criteria

The insight section uses the following rules, evaluated top-down.

Initial validation

  • if modal <= 0 or harga_jual <= 0
    • title: Complete Data
    • meaning: data is not yet sufficient to assess margin

Loss and break-even conditions

  • if harga_jual < modal

    • title: Negative Margin
    • meaning: every sale is still a loss
  • if harga_jual == modal

    • title: Break-Even Margin
    • meaning: selling price only covers cost, no profit yet

Positive margin levels

  • if margin < 5%

    • title: Very Thin Margin
  • if margin >= 5% and < 12%

    • title: Thin Margin
  • if margin >= 12% and < 20%

    • title: Margin Beginning to Form
  • if margin >= 20% and <= 35%

    • title: Healthy Margin
  • if margin > 35% and <= 50%

    • title: Strong Margin
  • if margin > 50% and <= 70%

    • title: Very High Margin
  • if margin > 70%

    • title: Margin Needs Validation

Insight Color and Visual Direction

Insights currently differ not only in text but also in icon and gradient color:

  • Complete Data -> light blue
  • Negative Margin -> orange to red
  • Break-Even Margin -> yellow-orange
  • Very Thin Margin / Thin Margin -> yellow-orange
  • Margin Beginning to Form -> blue
  • Healthy Margin -> green
  • Strong Margin -> green-blue
  • Very High Margin -> purple-blue
  • Margin 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 Margin displayed is a basic gross margin
  • not the final net margin

If the calculator is to become more realistic, the next version can add:

  • operational cost per unit
  • MDR deduction
  • average discount
  • returns
  • monthly fixed cost

This way, users can see:

  • gross margin
  • operational margin
  • net margin