Skip to content
Advertisement

SQLite – calculate percentage increase in values of a numeric column

I am interested in getting the % increase or decrease of the values in one column with respect to the previous value.

Can someone please advice how I should do this?

Thanks

This is what my table looks like

And this is what I would like

Advertisement

Answer

Use LAG() window function to get the previous value of sales for each week:

See the demo.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement