Skip to content

Instantly share code, notes, and snippets.

@eliquious
Last active June 16, 2020 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eliquious/6fa24217b504ed71f5c2d992c15e9539 to your computer and use it in GitHub Desktop.
Save eliquious/6fa24217b504ed71f5c2d992c15e9539 to your computer and use it in GitHub Desktop.
Profit Analysis
package main
import "fmt"
import "math"
const (
costPerMille float64 = 4.8
clickThroughRate float64 = 0.04
conversionRate float64 = 0.05
bundled = 1
units = 540
productUnitCost = 25.0
shippingPerUnitCost = 2444. / units
productTotal = 54.99
inventory = units/bundled - 1
productCost = productUnitCost * bundled
earningsGoal = inventory * productTotal
shippingCost = shippingPerUnitCost * units
calculateStorage = true
unitsPerBox = 60
boxMeasurements = 410 * 410 * 345 / 1e9
shipmentVolume = boxMeasurements * units / unitsPerBox
numPallets = shipmentVolume / 1.5731581
monthlyStorageCost = numPallets * 40
)
func main() {
fmt.Printf("CPM: $%0.2f\n", costPerMille)
fmt.Printf("CTR: %0.2f%%\n", clickThroughRate*100)
fmt.Printf("Conversion Rate: %0.2f%%\n", conversionRate*100)
fmt.Println()
const revenuePerSale = productTotal - productCost
fmt.Printf("Gross Earnings Goal: $%0.2f\n", earningsGoal)
fmt.Printf("Product Total: $%0.2f\n", productTotal)
fmt.Printf("Product Cost: $%0.2f\n", productCost)
fmt.Printf("Unit Price: $%0.2f\n", productTotal/bundled)
fmt.Printf("Revenue per Sale: $%0.2f\n", revenuePerSale)
fmt.Println()
// Sales per month
var sales = math.Floor(earningsGoal/productTotal + 1)
// Required Visitors
var visitors = sales / conversionRate
var adImpressions = visitors / clickThroughRate
// Product Cost + Earnings
var gross = sales * productTotal
var productExpenses = sales * productCost
var marketingBudget = adImpressions / 1000.0 * costPerMille
var revenue = gross - productExpenses - marketingBudget - shippingCost
var costPerPurchase = marketingBudget / float64(sales)
fmt.Printf("Required Gross Sales: %.0f\n", sales)
fmt.Printf("Required Visitors: %.0f\n", visitors)
fmt.Printf("Required Ad Impressions: %.0f\n", adImpressions)
fmt.Println()
fmt.Printf("Gross: $%.2f\n", gross)
fmt.Printf("Total Product Cost: $%.2f\n", productExpenses)
fmt.Printf("Required Marketing Budget: $%.2f\n", marketingBudget)
fmt.Printf("Shipping: $%.2f\n", shippingCost)
fmt.Printf("Net Revenue: $%.2f\n", revenue)
fmt.Println()
fmt.Printf("Total Upfront Cost: $%.2f\n", shippingCost+productExpenses)
fmt.Printf("Availabile for Reinvestment: $%.2f\n", gross-marketingBudget)
fmt.Printf("100%% Reinvestment Units: %.0f\n", (gross-marketingBudget)/(shippingPerUnitCost+productUnitCost))
fmt.Println()
fmt.Printf("Profit/Marketing Ratio: %.4f\n", revenue/marketingBudget)
fmt.Printf("Profit/Expenses Ratio: %.4f\n", revenue/(marketingBudget+productExpenses))
fmt.Printf("Marketing Cost per Visitor: $%.2f\n", marketingBudget/visitors)
fmt.Printf("Marketing Cost per Purchase: $%.2f\n", costPerPurchase)
fmt.Printf("Profit per Sale: $%.2f\n", revenuePerSale-costPerPurchase)
fmt.Println()
if calculateStorage {
fmt.Printf("Units per box: %d\n", unitsPerBox)
fmt.Printf("Shipment Volume: %0.4f CBM\n", shipmentVolume)
fmt.Printf("Num. Pallets: %0.f\n", numPallets)
fmt.Printf("Monthly Storage Costs: $%0.f\n", monthlyStorageCost)
fmt.Println()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment