A good quality dishwasher should last between 6 to 10 years but I've had a few brands that only last a couple years at most before needing replaced.
I would recommend buying either a Kenmore or Bosch Brand dishwasher for long lasting quality because the cheaper models will only last at most a few years.
You'd be lucky to get 6 to 10 years out of a cheaper model dishwasher.
So don't always go for cheaper but instead go for a quality reliable dishwasher brand because the cheaper dishwasher will be costing you more money in the long run when you have to replace it more often.