Calculating delta values in SQL

SELECT day, revenue, revenue - LAG(revenue, 1) OVER (ORDER BY day) AS daily_del FROM day;

The LAG() function does the job!!

Calculating the delta value is one of the most important job of a data scientist.

Built With

Share this project:

Updates