I don't mean knowing it after you wake up; I mean knowing within the dream that it's a dream.
With me it typically happens with anxiety dreams. Like last night. Even 10 years on from retirement I'm still having the following sort of anxiety dream: I was down to do the Modern Political Thought lectures, and come the day I haven't prepared either course outline or reading list. The first lecture is on Hegel and I have this ready - oh yes I have. But I've left the damn thing at the corner of a field, and now I can't find it there.
And then, in the dream, I think: this is too bad to be happening to me; I would never have let it happen. And I reassure myself that it's only a dream, and wake up.