there is nothing complicated with the formula, really. even though you technically use calculus, all you need to know is the power rule: d/dx x^{n} = n*x^{(n - 1)}. that’s it.

you first start with the value of the investment. it is equal to the present value of all cashflows.

if you have cashflow C_{t} at time t, its present value at time 0 is C_{t} * (1 + i)^{-t}

here, you are assuming a constant yield rate (this is a typical assumption when calculating Duration)

because the investment is the sum of all the present value of all cashflows,

P = sum over all t of PV( C_{t })

now, all you need to do is take this, and follow the steps above (differentiate with respect to the yield rate using the power rule and divide the result by P) and rearrange the terms so that you can express the answer in terms of Duration D.

duration D = sum over all t of (t * PV(C_{t} ) / P )