I have three columns – product name ie bn, date of product recieved and quantity_recieved columns,
I want to roll up the quantity recieved by month to date, year to date and quarter to date column.
How can I do this in redshift ?
I created the below syntax, but it gives me error.
SELECT
bn,
SUM(quantity_received) OVER (PARTITION BY DATE_TRUNC(‘month’, latest__delivery_date), DATE_TRUNC(‘year’, latest_delivery_date), isbn ORDER BY latest_vendor_delivery_date ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS month_to_date
from a
Any help would be greatly appreciated.