If a person has only daughters, the daughter's son can perform the last rites of the maternal grandparents.
He who has no son may make his daughter an ‘appointed daughter’ in the following manner: [He shall mark the declaration]—‘The child that may be born of her shall be the performer of my funeral rites’. – 9.127 (Manu)
Between the Son’s son and the Daughter’s son there is no difference in the world; since the daughter’s son also, like the son’s son, saves the man in the next world. – 9.139 (Manu)
A father who has no son should offer an oblation to Fire and Prajapati, proclaim ‘Your son is for my benefit’, and appoint his daughter. – 28. 18 (Gautama)
According to some,
he may appoint the daughter by his mere intention. – 28.19 (Gautama)
Garuda purana also says if the man has a brother who has a son, then that son should perform the funeral rites of the sonless man and his wife.
Manu also says
"The daughter’s son should offer two cakes (funeral rites), to his biological father and maternal grandfather. Its also mentioned that the appointed daughter’s husband (son-in-law) has the duty if she has no son."
Nowhere in the shastras it is said that a person can not perform the last rites of the sonless grandfather if the father is alive. However, in practice, if the daughter has two sons, the first son is bound to his father and mother and the second son is allowed to perform the last rites as well as yearly rites to his grandparents.