To assess 20-year retrospective trajectories of cardio-metabolic factors preceding dementia diagnosis among people with type 2 diabetes (T2D). We identified 227,145 people with T2D aged > 42 years between 1999 and 2018. Annual mean levels of eight routinely measured cardio-metabolic factors were extracted from the Clinical Practice Research Datalink. Multivariable multilevel piecewise and non-piecewise growth curve models assessed retrospective trajectories of cardio-metabolic factors by dementia status from up to 19 years preceding dementia diagnosis (dementia) or last contact with healthcare (no dementia). 23,546 patients developed dementia; mean (SD) follow-up was 10.0 (5.8) years. In the dementia group, mean systolic blood pressure increased 16–19 years before dementia diagnosis compared with patients without dementia, but declined more steeply from 16 years before diagnosis, while diastolic blood pressure generally declined at similar rates. Mean body mass index followed a steeper non-linear decline from 11 years before diagnosis in the dementia group. Mean blood lipid levels (total cholesterol, LDL, HDL) and glycaemic measures (fasting plasma glucose and HbA1c) were generally higher in the dementia group compared with those without dementia and followed similar patterns of change. However, absolute group differences were small. Differences in levels of cardio-metabolic factors were observed up to two decades prior to dementia diagnosis. Our findings suggest that a long follow-up is crucial to minimise reverse causation arising from changes in cardio-metabolic factors during preclinical dementia. Future investigations which address associations between cardiometabolic factors and dementia should account for potential non-linear relationships and consider the timeframe when measurements are taken.Supplementary InformationThe online version contains supplementary material available at 10.1007/s10654-023-00977-7.