Forum Discussion
Get correct file in the folder
- 3 years ago
Hi folks!
I've got what I wanted this way:1. Orderd the data from "Date"
2. Created a column with rank (0..N)
3. Created a condicional column that check if the file date is the last of the month OR rank = 0
4. Filtered true columns
#"Personalização Adicionada1" = Table.AddColumn(#"Colunas Renomeadas3", "LastDayMonthOrFirstLine", each if [Date created] = Date.EndOfMonth([Date created]) or [Rank] = 0 then 100 else 0)Tks for the helping!
as an example you do something like this and then the inverse with min for the other, create 2 queries one for min and one for max and then append them?
let
Source = Folder.Files("D:\OneDrive - foldername\Data"),
#"Filtered Rows" = Table.SelectRows(Source, let latest = List.Max(Source[Date modified]) in each [Date created] = latest)
in
#"Filtered Rows"
Tks for aswering!
I've tried that but, my issue here is that each month I need to pick the last file, it worked for the first two months, then it fails, because it's not the first and last only... is the first and like 5 last files of old months...
Tks!