Hi,
I have to create a Flow based on the below 2 conditions. The file names are always in 'XYZ_ddMMyy.xlsx' format.
Condition 1: If the file is not more than 14 days from today then it should be kept as it is
Condition 2: If the file belongs to the last day of every month or it is the last file of that month whether it is on last day or not then it should be kept as it is
I have been able to identify the 1st condition fully and also the 2nd condition partially i.e. whether the file belongs to the last day of the month or not. The portion which I am not been able to create is if the file doesn't belong to the last day of the month but it was the last file that we had received for that month. E.g. if we may have received a file on 24th and it was the last file that we had received for that month then this too should be considered. I mean I need the file with the MAX date for a month. This should be done for each of the months.
I am attaching the screenshots of the Flow and would appreciate if anyone can help me.
1st Compose Action: FilenameWithExtension
2nd Compose Action: substring(outputs('Compose_-_File_Name_with_Extension'), 25, 6)
3rd Compose Action: formatDateTime(concat('20', substring(outputs('Compose_-_Extracted_Date'), 4, 2), '-', substring(outputs('Compose_-_Extracted_Date'), 2, 2), '-', substring(outputs('Compose_-_Extracted_Date'), 0, 2)), 'yyyy-MM-dd')
4th Compose Action: formatDateTime(addDays(startOfMonth(addDays(outputs('Compose_-_Formatted_Date'), 1)), -1), 'yyyy-MM-dd')
Thank you.
