I have a date value for each customer id.I want to create a bin for each date on 30 days rolling basis till 36 months.Example data in the output ,I have provided till 4 months For customer id 001 purchase date is 12AUG2014.I need to calculate a 30 days period from 12AUG2014 .That would be 11SEP2014 .So M1_Start would be 12AUG2014 and end would be 11SEP2014 .Now M2_start would be 1 day after M1_end which is 12SEP2014.Again M2_END would be 30 days after 12SEP2014 which is 12OCT2014.So on .I have to calculate till M36_start and M36_end. Data I have -. cust_id purchase_dt 001 12-Aug-14 002 21-Aug-14 003 2-Sep-14 004 4-Aug-14 005 9-Aug-14 Data I want - cust_id purchase_dt M1_start M1_end M2_start M2_end M3_start M3_end M4_start M4_end 001 12-Aug-14 12-Aug-14 11-Sep-14 12-Sep-14 12-Oct-14 13-Oct-14 12-Nov-14 13-Nov-14 13-Dec-14 002 21-Aug-14 21-Aug-14 20-Sep-14 21-Sep-14 21-Oct-14 22-Oct-14 21-Nov-14 22-Nov-14 22-Dec-14 003 2-Sep-14 2-Sep-14 2-Oct-14 3-Oct-14 2-Nov-14 3-Nov-14 3-Dec-14 4-Dec-14 3-Jan-15 004 4-Aug-14 4-Aug-14 3-Sep-14 4-Sep-14 4-Oct-14 5-Oct-14 4-Nov-14 5-Nov-14 5-Dec-14 005 9-Aug-14 9-Aug-14 8-Sep-14 9-Sep-14 9-Oct-14 10-Oct-14 9-Nov-14 10-Nov-14 10-Dec-14 Thanks.Any leads will be very helpful.
... View more