The calculation is a single line. Net revenue retention equals starting recurring revenue, plus expansion, minus contraction, minus churn, divided by starting recurring revenue.
What each input means
Starting recurring revenue is the committed, repeating revenue of a fixed set of customers on day one of the period. Expansion is additional recurring revenue those same customers took on during the period, through upgrades, extra seats, added modules or price increases they accepted. Contraction is recurring revenue those customers gave up while remaining customers, through downgrades or seat reductions. Churn is recurring revenue lost from customers in the cohort who cancelled altogether. Revenue from any customer acquired after day one is excluded from every term in the formula.
A worked example (illustrative figures)
Suppose a cohort of customers is producing ₹10,00,000 of monthly recurring revenue on the first of the month. Over the month, existing customers add ₹1,50,000 of expansion. Two accounts downgrade, giving up ₹30,000 between them. One account cancels, taking ₹70,000 with it. Closing recurring revenue for the cohort is 10,00,000 plus 1,50,000 minus 30,000 minus 70,000, which is ₹10,50,000. Divide that by the starting ₹10,00,000 and you get 1.05, so NRR for the month is 105%. Gross revenue retention for the same month excludes the expansion: 10,00,000 minus 30,000 minus 70,000 is ₹9,00,000, which divided by the start gives 90%. The two numbers together say something the first one alone does not, which is that the base lost a tenth of its revenue and expansion more than covered it.