Do you have a windshield on your bike? If you do always park your bike on a sunny day pointing towards the sun.
If you park your bike pointing away from the sun, it will reflect off the curved windshield and reflect back on your tank and speedometer, like a big curved mirror.
The sunlight will also be shining directly on the tank, and that can be enough to cook an electronic speedometer cluster.
I dont know if you can preprogram a used one for the correct mileage. If not write the mileage the bike had when you replaced it, and the mileage on the new speedo, in your owners manual in the service record section.