AJ is exactly right. Most city water (and certainly well water) is high in mineral concentrations. The makers of most dishwasher detergents agree that the ideal water hardness should be close to 5 grains. If we multiply this by 17.5, we get the parts per million (PPM). Since buying a mechanical softener is fairly expensive, the best alternative is to choose a detergent that will do all this for you.
Over the years, I have experimented with all varieties of dishwasher products. I've attended lectures by representatives from Proctor & Gamble about the science behind the products, and why certain ones work better in hard water. For instance, the tablets contain not only detergent but a rinse agent as well. A rinse agent is a fancy term for softener. It allows the water to sheen off of the glasses and not spot. There are even certain brands which work better than others, I discovered. My favorite for the moment is Electrasol Tablets, with the Powerball.
My own water comes from a well, and I measured the hardness at 22 grains last year. With these Electrasol tabs, I have had absolutely no buildup whatsoever in my dishwasher, and everthing comes out spotless. So far, they have Cascade beat hands down, plus I do not have to spend money on Jet Dry any more.