avg sale of quarter with previous quarter avg sale
问题 I have a table one in which there are various attribute like region product,year,qtr,month,sale. I have to calculate the avg_qtr sale of each product having same region and show their previous avg_qtr sale.I have read about lag but here it is not possible to use as it is not fixed after how many rows it will be repeated. My table structure is like this Region Product Year Qtr Month Sales NORTH P1 2015 1 JAN 1000 NORTH P1 2015 1 FEB 2000 NORTH P1 2015 1 MAR 3000 NORTH P1 2015 2 APR 4000 NORTH