I find myself deep down a rabbit hole on this. I thought this was going to be simple but ... Transforming data from a legacy system into on table with start/end date for each ID_GROUP and ID_STATUS.
Here are the requirements/constraints:
The Legacy system puts things into ID_GROUP groups. Those groups can be ACTIVE or in various types of INACTIVE. We want to summarize and capture a start/end date for each ID_STATUS.
Usually (Not always!) a CREATE record is the start date. A DELETE record is the final END DATE.everything else is grouped as a MODIFY record.
ID_STATUS are being made ACTIVE, for very short periods of time, to edit the record. If a ID_GROUP status is ACTIVE for less than one day we want to ignore that record. Once an ID_GROUP is created the timeline should be inclusive until deletion.
If a CREATE record doesn't exist the Start Date should be the FILE_DT. If the ID_STATUS is valid presently, the end date should reflect that.
All Help is appreciated.
Sample data file attached.