I need help in solving the following issue I am having.
I have a table with the following fields.
ID - User ID
StartDate (The date of the first visit)
StartMonthYear (The month and year of the first visit)
VisitDate (Date of any visits that have occurred)
VisitMonthYear (Month and Year if the visit)
I need to create a flag, that will flag all the visits that have occurred in the 6 month post StartDate
For example if a client first visit was on Jan 1st 2016, and he comes on the 1st of the month every month. The flag will have the all the fields that are associated with his visits for the next 6 month which includes Jan 1st through June 1st 2016.
This really depends on how your data model looks. But in general you can do something like:
IF(VisitDate <= AddMonths(StartDate,6),1,0)
If you dates are stored vertical (in rows) it will be more complicated because you will need to find the start date for each individual ID and then compare that to the visit dates.