Adding pivot query for periods: columns to records