Forum Discussion
flowgistics
5 years agoFrequent Visitor
Filter column if Source.Name corresponds to Source.Name in last row
Hi everyone, I'm not looking through M-code that well yet and hope that somebody can help me with my problem: I'm importing .txt files through folder import, but only want the latest report to b...
- Anonymous5 years ago
Hi flowgistics
Have been very busy lately. So you have all the files in one folder like this? And you want the archive data file and the latest version of xyz? Are you going to use the Date created or the date in filename to identify the latest version?
here is one using Date created
let Source = Folder.Files("folderpath"), #"Filtered Rows" = Table.SelectRows(Source, each Text.Contains([Name],"archive") or [Date created] = List.Max(Source[Date created])) in #"Filtered Rows"
flowgistics
5 years agoFrequent Visitor
Hi Anonymous
Thanks that works!
Regarding using the filename instead: can you think of a solution using the current date in order to compare it to the closest date of a filename and then select this file?
Anonymous
5 years agoNot applicable
Hi flowgistics
you mean 20210815 extracted from filename and compare with today? Can't use the Max date...you might get some date in the future?