Menu

Customer concentration in a few lines: top-1, top-3 and HHI without floats
📰

Customer concentration in a few lines: top-1, top-3 and HHI without floats

DEV Community: datascience·Tidy Cents·about 18 hours ago
#qaFeTNEn
#devtodatascience#science#devto#dev#customer
Long article (442 words) — no AI summary yet.
Reading 0:00
15s threshold

"How dependent are we on one customer?" sounds like a judgment call. It is three numbers: the biggest customer's share of revenue, the top three's share, and the Herfindahl-Hirschman Index (HHI), the sum of squared shares that competition economists use for market concentration.

// Customer concentration: top-1 / top-3 share and HHI from a revenue list (integer cents). const rev = [ 1_400_000n , 700_000n , 500_000n , 400_000n , 300_000n , 300_000n , 200_000n , 200_000n ] ; // monthly, cents const total = rev . reduce ( ( a , b ) => a + b , 0n ) ; const sorted = [ . . . rev ] . sort ( ( a , b ) => ( b > a ? 1 : b < a ? - 1 : 0 ) ) ; const bp = x => x * 10000n / total ; // share in basis points const top1 = bp ( sorted [ 0 ] ) , top3 = bp ( sorted [ 0 ] + sorted [ 1 ] + sorted [ 2 ] ) ; const hhi = sorted . reduce ( ( s , x ) => { const sh = x * 10000n / total ; return s + sh * sh ; } , 0n ) / 10000n ; // 0..10000 scale console .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.