Deal size bands from a CSV with the columns deal,amount,outcome (outcome is won or lost).
Band edges default to 5000,20000,50000, which gives four bands: under 5,000; 5,000 to 19,999;
20,000 to 49,999; 50,000 and over. A deal whose amount equals an edge belongs to the band that
starts at that edge. Amounts must be non-negative numbers.
Summary
Functions
Index of the band an amount falls in, for the given ascending edges.
Per-band deals, wins, win rate and share of won revenue.
The default band edges.
Band labels for the given edges.
Median won deal size, or nil when nothing was won.
Parse the CSV text into deals.
Parse a comma separated edge list such as 5000,20000,50000 (strictly ascending whole numbers, at least one).
Printable table followed by the median won deal size.
Types
@type band() :: %{ label: String.t(), deals: non_neg_integer(), won: non_neg_integer(), win_rate: float() | nil, won_revenue: number(), share: float() | nil }
Functions
@spec band_index(number(), [non_neg_integer()]) :: non_neg_integer()
Index of the band an amount falls in, for the given ascending edges.
@spec bands([deal()], [non_neg_integer()]) :: [band()]
Per-band deals, wins, win rate and share of won revenue.
The default band edges.
@spec labels([non_neg_integer()]) :: [String.t()]
Band labels for the given edges.
Median won deal size, or nil when nothing was won.
Parse the CSV text into deals.
@spec parse_edges(String.t()) :: {:ok, [non_neg_integer()]} | {:error, String.t()}
Parse a comma separated edge list such as 5000,20000,50000 (strictly ascending whole numbers, at least one).
Printable table followed by the median won deal size.