Add previous day records; delete Earliest Date records; retain max 5 days of records in a module

rmat066sysf
Occasional Contributor

Add previous day records; delete Earliest Date records; retain max 5 days of records in a module

I have a module in which I import #rows of data for previous day

I  want to hold only 5 days of data.

Everyday I want to delete earliest date #rows  to ensure I hold only 5 days  data

 

Appreciate your input.

4 REPLIES 4
nikolay_denisov
Certified Master Anaplanner

Re: Add previous day records; delete Earliest Date records; retain max 5 days of records in a module

Hi,
I will try to share my vision and might be some details missing, but we can discuss them further if needed.
Im guessing but you would need to have a day indication in your source data and have indication of the current day in a model.
Current day might be coming also as a part of the import or via Anaplan Connect Script or set manually.
Then you could calculate relevant scope for data storage and mark not in scope records with boolean TRUE. Then you could automatically clean them by action of "delete from list using selection"
So data Import, date update, clean action could be sitting in the same process.
Please let me know what you think about it
andrewtye
Master Anaplanner/Community Boss

Re: Add previous day records; delete Earliest Date records; retain max 5 days of records in a module

Agreed - that seems the most sensible.

abhay.kanik
Regular Contributor

Re: Add previous day records; delete Earliest Date records; retain max 5 days of records in a module

@rmat066sysf 

 

I have a different approach from @andrewtye @nikolay_denisov , Please suggest if this approach has a particular issue .

In this approach you wont be required to do current date hustle.

 

Add 3 line items to your module 

 

  1. Line item 1 - Date (Date Formatted) - Import date into this one
  2. Line item 2 - Rank(Number formatted) - use the formula Rank(Date) . It will give rank to your date from latest to oldest by default.
  3. Line item 3 - Delete Flag (Boolean) - Use the formula Rank>5 , All the dates older than 5 days will be true and you can run a delete action using selection with this flag to delete older days data.

Delete timer.PNG

Thanks

Abhay

 

rmat066sysf
Occasional Contributor

Re: Add previous day records; delete Earliest Date records; retain max 5 days of records in a module

Thank you all