Multiple formulas for r squared eval metric for regression
Both are correct. R squared tells you how many variance of the dependent variable is explained by your model. This can be written in different ways.
It is like to say that the probability of being alive is 1 minus the probability of dying. 

ESS=TSS-RSS

https://en.m.wikipedia.org/wiki/Coefficient_of_determination

[1]: https://i.stack.imgur.com/QlM6O.jpg