Forum Discussion

MF_BI's avatar
MF_BI
Regular Visitor
4 years ago
Solved

Flag Period

Hello all,

 

I have this kind of table below : 

Order date idfirst use date 
11/01/2021 15:18id111/01/2021 10:11
11/01/2021 10:11id111/01/2021 10:11
12/01/2021 12:53id111/01/2021 10:11
09/02/2021 15:18id111/01/2021 10:11
15/03/2021 14:54id111/01/2021 10:11
15/04/2021 14:37id111/01/2021 10:11
17/05/2021 10:42id111/01/2021 10:11
01/06/2021 12:16id111/01/2021 10:11
07/01/2021 08:53id207/01/2021 08:53
06/02/2021 11:47id207/01/2021 08:53
11/03/2021 11:16id207/01/2021 08:53

 

and I want to add column with Flag, that indicate by users id if the order date is in the first month after first use (First use date+30days), or in the second the seconde month(Between First use date+30 and First use date+60), or in the third month(Between First use date+60 and First use date+90),etc... as the table below : 

Order date idfirst use date Flag
11/01/2021 15:18id111/01/2021 10:11M1
11/01/2021 10:11id111/01/2021 10:11M1
12/01/2021 12:53id111/01/2021 10:11M1
09/02/2021 15:18id111/01/2021 10:11M1
15/03/2021 14:54id111/01/2021 10:11M3
15/04/2021 14:37id111/01/2021 10:11M4
17/05/2021 10:42id111/01/2021 10:11M5
01/06/2021 12:16id111/01/2021 10:11M5
07/01/2021 08:53id207/01/2021 08:53M1
06/02/2021 11:47id207/01/2021 08:53M1
11/03/2021 11:16id207/01/2021 08:53M3

 

Thank you for your help. I appreciate that.

 

Best,