calculate period only first time