Forum Discussion

AnttiKoskinen's avatar
AnttiKoskinen
Frequent Visitor
2 years ago
Solved

Latest date as filter in Power BI Dataflow

I'm trying to set a scheduled refresh with following piece of code, which system created automatically for me:

 

 #"Filtered rows 1" = Table.SelectRows(#"Filtered rows", let latest = List.Max(#"Filtered rows"[Date created]) in each [Date created] = latest),
  Navigation = #"Filtered rows 1"{[Name = "bi_daily_examplefile_-_completions_10042024_production.csv", #"Folder Path" = "https://examplecompany.sharepoint.com/sites/Example Site/Shared Documents/Reporting/Production/"]}[Content],
  #"Imported CSV" = Csv.Document(Navigation, [Delimiter = ",", Columns = 86, Encoding = 65001, QuoteStyle = QuoteStyle.None]),
 
With this code scheduled refresh fails because I have filtered the latest date but Navigation line refers to hard coded file not the latest filtered one.
 
Is there a way to code this differently and refer to #"Filtered rows 1" in Navigation?
  • do you want to import the last modified file?  Sort the folder contents accordingly and then grab the binary from row 0.

2 Replies

  • do you want to import the last modified file?  Sort the folder contents accordingly and then grab the binary from row 0.