Check if years is non empty before filtering