I don't have a lot of time to write, so I'm always very cautious about setting writing goals. I don't even track my word counts. Why? Because it depresses me every time I see friends on Facebook or on the forums talk about how they wrote 1000 words today, or 3000, or however many. If I counted, I'd probably end up with 100, or some number that merely indicates I redid a scene with hardly any wordcount change. And of course there are always days when I get zero words. But zero words might mean I was too sick or busy - or it might mean that I got a lot of fruitful thinking done, just no typing.
My number one rule of goal-setting is "be compassionate with yourself." I focus on saying "I did a bit of work today," and on keeping a sense of momentum.
That said, there are times when setting a goal can be motivating. Don't set one that's too big, like "I have to write a novel as soon as possible." Ouch! If you're writing a novel, and it's a big project, it's a good idea to find ways to keep your eyes on the prize, but break it down. I made some good progress yesterday (unexpectedly) and now I'm thinking, "Can I get Chapter 5 done by Monday?"
For me, goals come in several categories.
1. Write every day. For this one, thinking/plotting/outlining count. This is maintaining momentum.
2. When you sense a potential goal close, try giving yourself a timeline to reach it. I'd call this one opportunistic goal-setting. It can help you get a boost of motivation over a short time period.
3. When you have a big project, set smaller goals. Set a chapter writing-rate goal, realizing that it will vary longer/shorter depending on the demands of your life. Set a chunk goal, too. My current chunk goal is to get to Chapter 10 - the end of a major arc. My sense of when I'll finish the whole novel will depend on how long it takes me to get to Chapter 10, and how I feel at that point.
I speculate about how I'd like to finish writing this novel by next October or so. It's a good thing to imagine, but at the moment I have no idea how realistic it is. It depends on too many factors. If you find your larger goals are overwhelming you, be compassionate with yourself. Break down your goals to make them more manageable. Then as the smaller ones are achieved, you can get a better sense of what to expect with the larger ones.
Above all, don't punish yourself for underperformance. It will only make things worse.