That kind of calculation is often what separates the good players from the rest. (Although, I would have played differently earlier and may not have ended up in that situation)
Before posting, please proofread to ensure your post uses proper grammar and is free of spelling mistakes or typos. If you're asking a question about a specific game, please provide a link to that game in your post.