This is also dangerously close to going backwards about it. Figuring out how much you need to do something purely to "get your money's worth" out of it is the sunk cost fallacy!
It's better to start from how many times you want to go to the gym, multiply it with your desired cost per visit, and then see if this total exceeds the cost of the membership.
I know that's what you were suggesting, but the way you presented it seems to me, well, backwards!