deal_size_distribution

Copy Markdown View Source

Elixir library and Mix task. Give it a CSV of closed deals (name, amount, won or lost) and it groups them into size bands and prints, for each band, the number of deals, the number won, the win rate and that band's share of all won revenue, followed by the median won deal size.

Bands come from the edges you pass with --bands (default 5000,20000,50000), which gives: under 5,000; 5,000 to 19,999; 20,000 to 49,999; 50,000 and over. A deal whose amount equals an edge goes in the band that starts at that edge. Win rate is won deals divided by all deals in the band. Share of won revenue is the band's won amount divided by the total won amount. Non-numeric or negative amounts stop the run with an error naming the line.

Part of the OneGTMLab free GTM tools. Background on the idea: ideal customer profile.

Install

{:deal_size_distribution, "~> 1.0"}   # in mix.exs deps

Use

CSV columns: deal, amount, outcome (won or lost). Optional: --bands 5000,20000,50000 (band edges, strictly ascending).

$ mix deal.size_distribution sample.csv
band                 deals  won  win rate  won revenue share
under 5,000              3    2     66.7%               4.3%
5,000 to 19,999          4    2     50.0%              13.0%
20,000 to 49,999         3    2     66.7%              39.1%
50,000 and over          2    1     50.0%              43.5%

median won deal size: 10,000

Test

mix test

Offline, no network calls, no dependencies beyond the language runtime. MIT licensed.