update trend calculation