It is not the last few years. It is whatever the highest average range was over a period of 12-36 months.
Source (look at Final Compensation in the Retirement Calculation Formula subheading): https://www.calpers.ca.gov/page/active-members/retirement-be...