implement the filtering by period