there could be a break in the wire somewhere ,which you can track down with a ohm meter (multi tester) or there a problem with the switch . the part you pass the magnet . here check this out ,
http://sheldonbrown.com/cyclecomputer-troubleshoot.html , I hope this help .