This is a question that every test taker must answer and there is no set answer.
Here are some general guidelines:
-Work backwards in terms of timeline...start with the application due dates for your target schools
-If you can self report your scores, you can take the GMAT at any time before the deadline (even the day you submit the applications)
-Prepare to take 2 exams before the deadline
-Remember that you have to wait 31 days between exams (GMAT takes that long to cycle through questions)
-Recognize that the GMAT takes a while to prepare for and if you don't give yourself enough time to prepare you might have to apply to a later round or a future year
-Remember that you don't have to score a 750+ to get into a top school...schools accept students from a wide range of scores and the GMAT is only part of your application
If you find yourself really struggling with your GMAT timeline, you might see help from an admissions consultant to work up a timeline.
KW