You have to have your I140 approved and 180 days after I485 filed. Both conditions must stand at the same time.