Severe vitamin B12 deficiency can cause a dementia along with weakness, unsteadiness and visual problems. It may be caused by pernicious anemia or conditions causing very severe problems of absorption of vitamins from the bowel.
It can be detected by blood testing but nowadays in the developed world the underlying cause is usually recognized long before dementia begins. However, if left untreated for too long, the damage may not be reversible.