Hola Sourin,
Gracias por el comentario y por señalar esto.
Yo también no puedo hacerlo y obtengo el mismo error.
Saludos cordiales,
Naim Khan
Avalados por :
SELECT "AÑO_MES","MES","INGRESOS",
AVG("INGRESOS") OVER (ORDER BY "AÑO_MES" ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING) PromedioMovil
FROM "ESQUEMA"."TABLA" ;
Hola Sourin,
Gracias por el comentario y por señalar esto.
Yo también no puedo hacerlo y obtengo el mismo error.
Saludos cordiales,
Naim Khan
Hi Sourin,
Thanks for the kind words, I tried for multiple years and in that case we have to use PARTITION BY as shown below.
When you want the values of the same year to be considered then use PARTITION BY.
SELECT "YEAR_MONTH","YEAR","REVENUE",
AVG("REVENUE") OVER (PARTITION BY "YEAR" ORDER BY "YEAR_MONTH" ROWS BETWEEN CURRENT ROW AND 2 FOLLOWING) RollingAverage
FROM "SCHEMA"."TABLE";
When you want the values irrespective of the year then don't use PARTITION BY.
SELECT "YEAR_MONTH","YEAR","REVENUE",
AVG("REVENUE") OVER (ORDER BY "YEAR_MONTH" ROWS BETWEEN CURRENT ROW AND 2 FOLLOWING) RollingAverage
FROM "SCHEMA"."TABLE";
Hope I was able to clarify your doubts.
Once again thanks for the kind words.
Best Regards,
Naim Khan
contacto@primeinstitute.com
(+51) 1641 9379
(+57) 1489 6964
© 2024 Copyright. Todos los derechos reservados.
Desarrollado por Prime Institute