How can I calculate sample size while designing a retrospective cohort study? I am aiming to develop a retrospective study involving chart review of cancer patients, all having a specific type of disease. I then aim to perform various types of survival analyses on my dataset such as Overall Survival and Progression Free Survival comparing a group of patients receiving specific treatment for < 5 months vs another group receiving it for 5 months or more.
However, I would like to ascertain early on how many patients to review and collect data for in order to ensure good statistical power while carrying out my survival analysis. Are there any calculators available online that can be used to determine a sample size? Happy to share additional details about the study design to help clarify this question further.

For a simple two-group comparison the following formula is a useful guide. If the proportion of patients in one group is $p$, your specified type 1 error is $\alpha$, and the hazard ratio you would like to detect is $\text{HR}$, then (adapting from Therneau and Grambsch, equation 3.14) you need to collect data on $d$ events determined by:
\begin{equation}
d = \frac{(c_{\alpha} + z_\text{power})^2}{p (1-p) (\log\text{HR})^2}.
\end{equation}
Here $c_{\alpha}$ is the critical value for the test at the specified type 1 error (e.g., 1.96 for a 2-sided test at $\alpha= 0.05$) and $z_\text{power}$ is the upper standard normal quantile at the desired power (0.84 for 80% power, 1.28 for 90% power). As an example, for a 30/70 group percentage split, $\alpha= 0.05$ in a 2-sided test and the HR of 0.5 that you specify in a comment, you would need data on 104 events for 90% power. Use your estimate of event rates per group to determine how many charts you need to review to find that many total events.
Although Therneau and Grambsch present that formula in the context of exponential survival curves, Schoenfeld showed that it works more generally for the score test under the proportional hazards (PH) assumption. Hsieh and Lavori showed how to extend this to continuous predictors (replacing $p(1-p)$ in the denominator with $\sigma^2$ for the continuous predictor); they also showed how to take covariate adjustments and predictor correlations into account.
I use the tools provided when you load Frank Harrell's R rms package (which also loads his Hmisc package). He notes them briefly here. His cpower() function calculates power from assumed group sizes and event rates, allowing for prospective designs based on accrual rates and minimum follow-up times, and using a modified variance formula. Harrell's spower() function and the R powerSurvEpi package provide power estimates in some more complicated circumstances.
Working with Harrell's packages would also make available to you the extensive resources they provide for reliable regression modeling of many types, including survival models.
In your example you would need to be cautious in a few respects. First, if the difference is the extent of time over which the therapy was received, you would presumably have to count events only after the 5-months period when the groups diverged. Second, choices about how long therapy was provided or received often have to do with clinically significant, outcome-associated variables that you will have to adjust for very carefully. Third, I sense some risk of survivorship bias here, as having received therapy for 5 months or longer implies that the individual has already survived that long.
