past data function