renamed last week profit to last period and changed it so any period can be used