+ 2
Redshift SQL date function
I’m using a date stamped report and want to write a script that will calculate the daily, month-to-date and year-to-date movements, but am struggling!!! This needs to take into account business days only, so using (date - 1 ) will not work - anyone able to assist?
5 odpowiedzi
+ 1
Hi guys, apologies for not responding!
So i have a report, ‘Report-Data’ which updated on the daily with data, which is date stamped. eg
rep_date value
2018-09-10 2
2018-09-11 3
2018-09-12 2.5
2018-09-14 2
so i would like to create a VIEW which subtracts the previous day’s value:
output:
rep_date value change
2018-09-10 2 2
2018-09-11 3 1
2018-09-12 2.5 -0.5
2018-09-14 2 -0.5
sorry for typing it like this - not sure how else to describe it?
something you need to know - there will be gaps in the days and i would like to have a MTD and YTD column as well?
+ 14
Zane Van Der Schyff Please provide more information. Give me input data and desired output.
+ 9
Randomcoder Sorry. I still don't understand... What is "change" attribute? Do you get it from somewhere or it's just a your result? How is your desired value counted? value - change or change - value?
0
hi.......
0
i want to know more about html.....
could you please......send me the notes