l=Transpose@{Table[i,{i,1,168}]};
r=ArrayReshape[#,{168,24}]&@Flatten@Table[IdentityMatrix[24],7];
A=ArrayFlatten[{{l,r}}];

p=Table[RandomInteger[{10,20}],24];
y=Table[i*0.3*RandomInteger[{0,1}]+p[[Mod[i,24]+1]],{i,1,168}]

ap=LeastSquares[A,y]
A.ap