The best time to flush your cannabis plant's soil depends on a few things. First, look at the trichomes on your buds. When they start to turn milky or amber, it's usually a good time to start flushing. Second, consider the type of growing medium you're using. Soil takes longer to flush than something like coco coir.
To be safe, a week or two before you think you'll harvest is usually a good time to start. You'll want to water your plants with plain pH-balanced water for a while to clear out any excess nutrients.